<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );

/**
*
* @package MediaLibrary
* @copyright 2009 Andrey Kvasnevskiy-OrdaSoft(akbet@mail.ru);Rob de Cleen(rob@decleen.com)
* Homepage: http://www.joomlawebserver.com
* @version: 1.5.3 Basic $
*
**/


require_once ($mosConfig_absolute_path."/libraries/joomla/factory.php");
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );


?>

<?php
// ensure this file is being included by a parent file



$bid = mosGetParam($_POST, 'bid', array (0));

require_once ($mosConfig_absolute_path."/administrator/components/com_medialibrary/admin.medialibrary.class.ws.php");

require_once ($mosConfig_absolute_path."/administrator/components/com_medialibrary/admin.medialibrary.class.others.php");



function catOrderDownIcon( $i, $n, $index, $task='orderdown', $alt='Move Down' ) {
	if ($i < $n-1 ) {
		return '<a href="#reorder" onclick="return listItemTask(\'cb'.$index.'\',\''.$task.'\')" title="'.$alt.'">
			<img src="images/downarrow.png" width="12" height="12" border="0" alt="'.$alt.'" />
		</a>';
	} else {
		return '&nbsp;';
	}
}

function catOrderUpIcon( $i,$index, $task='orderup', $alt='Move Up' ) {
	if ($i > 0 ) {
		return '<a href="#reorder" onclick="return listItemTask(\'cb'.$index.'\',\''.$task.'\')" title="'.$alt.'">
			<img src="images/uparrow.png" width="12" height="12" border="0" alt="'.$alt.'" />
		</a>';
	} else {
		return '&nbsp;';
	}
}



class HTML_Categories
{

	function show(&$rows, $myid, &$pageNav, &$lists, $type)
	{
		global $my,$mainframe,$mosConfig_live_site ;

		$section = "com_medialibrary";
		$section_name = "MediaLibrary";
		$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/medialibrary.css" type="text/css" />');

        ?>
		<form action="index2.php" method="post" name="adminForm">

		<table cellpadding="4" cellspacing="0" border="0" width="100%">
		<tr>
      <td width="30%">
        <img src="./components/com_medialibrary/images/cfg.png" align="right" alt="Config" />
      </td>
      <td width="70%" class="media_manager_caption" valign='bottom' >
				<?php echo _MEDIALIBRARY_CATEGORIES_MANAGER; ?>
			</td>
		</tr>
		</table>
		
		<table class="adminlist">
		<tr>
			<th width="20">
			#
			</th>
			<th width="20">
			<input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count($rows);?>);" />
			</th>
			<th align = "center" class="title">
			<?php echo _HEADER_CATEGORY;?>
			</th>
			<th align = "center" width="5%">
			<?php echo _HEADER_NUMBER;?>
			</th>

			<th align = "center" width="10%">
			<?php echo _HEADER_PUBLISHED;?>
			</th>
			<?php
			if ($section <> 'content') {
        	?>
				<th align = "center" colspan="2">
				<?php echo _HEADER_REORDER;?>
				</th>
				<?php
			}

        ?>
			<th align = "center" width="10%">
			<?php echo _HEADER_ACCESS;?>
			</th>
			<?php
			if ($section == 'content') {

            ?>
				<th width="12%" align="left">
				Section
				</th>
				<?php
			}

        ?>
			<th align = "center" width="12%">
			ID
			</th>
			<th align = "center" width="12%">
			<?php echo _HEADER_CHECKED_OUT;?>
			</th>
		  </tr>
		<?php
		$k = 0;
		$i = 0;
		$n = count($rows);
		foreach ($rows as $row) {
			$img = $row->published ? 'tick.png' : 'publish_x.png';
			$task = $row->published ? 'unpublish' : 'publish';
			$alt = $row->published ? 'Published' : 'Unpublished';
			if (!$row->access) {
				$color_access = 'style="color: green;"';
				$task_access = 'accessregistered';
			} else if ($row->access == 1) {
				$color_access = 'style="color: red;"';
				$task_access = 'accessspecial';
			} else {
				$color_access = 'style="color: black;"';
				$task_access = 'accesspublic';
			}

            ?>
			<tr class="<?php echo "row$k";?>">
				<td width="20" align="right">
				<?php echo $pageNav->rowNumber($i);?>
				</td>
				<td width="20">
				<?php echo mosHTML::idBox($i, $row->id, ($row->checked_out_contact_category && $row->checked_out_contact_category != $my->id),'bid');?>
				</td>
				<td width="35%">
				<?php
				if ($row->checked_out_contact_category && ($row->checked_out_contact_category != $my->id)) {

                ?>
					<?php echo $row->treename . ' ( ' . $row->title . ' )';?>
					&nbsp;[ <i>Checked Out</i> ]
					<?php
				} else {

                ?>
					<a href="#edit" onClick="return listItemTask('cb<?php echo $i;?>','edit')">
					<?php echo $row->treename . ' ( ' . $row->title . ' )';?>
					</a>
					<?php
				}

            ?>
				</td>
				<td align="center">
				<?php echo $row->nbook;?>
				</td>

				<td align="center">
				<a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')">
				<img src="images/<?php echo $img;?>" width="12" height="12" border="0" alt="<?php echo $alt;?>" />
				</a>
				</td>

					<!-- old td  >
					<?php echo $i. $pageNav->orderUpIcon($i);?>
					</td>
					<td>
					<?php echo $i. "::".$n.$pageNav->orderDownIcon($i, $n);?>
					</td-->
					<td>
					<?php

                                         echo catOrderUpIcon($row->ordering - 1,$i);?>
					</td>
					<td>
					<?php

                                          echo catOrderDownIcon($row->ordering -1 , $row->all_fields_in_list   , $i );?>
					</td>

				<td align="center">
				<a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>','<?php echo $task_access;?>')" <?php echo $color_access;?>>
				<?php echo $row->groupname;?>
				</a>
				</td>
				<td align="center">
				<?php echo $row->id;?>
				</td>
				<td align="center">
				<?php echo $row->checked_out_contact_category ? $row->editor : "";?>				
				</td>
				<?php
				$k = 1 - $k;

            ?>
			</tr>
			<?php
			$k = 1 - $k;
			$i++;
		}

        ?>
                <tr><td colspan = "11"><?php echo $pageNav->getListFooter();?></td></tr>
		</table>
		
	
		<input type="hidden" name="option" value="com_medialibrary" />
		<input type="hidden" name="section" value="categories" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="chosen" value="" />
		<input type="hidden" name="act" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="type" value="<?php echo $type;?>" />
		</form>
		<?php
	}


	/**
    * Writes the edit form for new and existing categories
    * 
    * @param mosCategory $ The category object
    * @param string $ 
    * @param array $ 
    */
	function edit(&$row, $section, &$lists, $redirect)
	{
		global $my, $mosConfig_live_site,$mainframe;

		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'. $mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');

		$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/medialibrary.css" type="text/css" />');
		global $mosConfig_live_site,$option;
		if ($row->image == "") {
			$row->image = 'blank.png';
		}
		mosMakeHtmlSafe($row, ENT_QUOTES, 'description');

        ?>
		<script language="javascript" type="text/javascript">
		function submitbutton(pressbutton, section) {
			var form = document.adminForm;
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}

			if ( form.name.value == "" ) {
				alert('<?php echo _DML_CAT_MUST_SELECT_NAME;?>');
			} else {
				<?php getEditorContents('editor1', 'description') ;?>
				submitform(pressbutton);
			}
		}
		</script>
	
		<form action="index2.php" method="post" name="adminForm">
		<table >
		<tr>
			<th  class="media_manager_caption" align="left">
			<?php echo $row->id ? _HEADER_EDIT : _HEADER_ADD;?> <?php echo _CATEGORY;?> <?php echo $row->name;?>
			</th>
		</tr>
		</table>

		<table width="100%">
		<tr>
			<td valign="top">


				<table class="adminform">
				<tr>
					<th colspan="3">
					  <?php echo _CATEGORIES__DETAILS;?>
					</th>
				</tr>
				<tr>
					<td>
					  <?php echo _CATEGORIES_HEADER_TITLE;?>:
					</td>
					<td colspan="2">
					  <input class="text_area" type="text" name="title" value="<?php echo $row->title;?>" size="50" maxlength="50" title="A short name to appear in menus" />
					</td>
				</tr>
				<tr>
					<td>
					  <?php echo _CATEGORIES_HEADER_NAME;?>:
					</td>
					<td colspan="2">
					  <input class="text_area" type="text" name="name" value="<?php echo $row->name;?>" size="50" maxlength="255" title="A short name to appear in menus" />
					</td>
				</tr>
				<tr>
					<td align="right">
                                          <?php echo _CATEGORIES__PARENTITEM;?>:</td>
					<td>
					  <?php echo $lists['parent'];?>
					</td>
				</tr>
				<tr>
					<td>
					  <?php echo _CATEGORIES_HEADER_IMAGE;?>:
					</td>
					<td>
					   <?php echo $lists['image'];?>
					</td>
					<td rowspan="4" width="50%">
					<script language="javascript" type="text/javascript">
					if (document.forms[0].image.options.value!=''){
						jsimg='../images/stories/' + getSelectedValue( 'adminForm', 'image' );
					}
					else
					{
						jsimg='../images/M_images/blank.png';
					}
					document.write('<img src=' + jsimg + ' name="imagelib" width="80" height="80" border="2" alt="<?php echo _CATEGORIES__IMAGEPREVIEW;?>" />');
					</script>
					</td>
				</tr>
				<tr>
					<td>
					  <?php echo _CATEGORIES_HEADER_IMAGEPOS;?>:
					</td>
					<td>
					  <?php echo $lists['image_position'];?>
					</td>
				</tr>
				<tr>
					<td>
					  <?php echo _CATEGORIES_HEADER_ORDER;?>:
					</td>
					<td>
					  <?php echo $lists['ordering'];?>
					</td>
				</tr>
				<tr>
					<td align = "center">
					  <?php echo _HEADER_ACCESS;?>:
					</td>
					<td>
					  <?php echo $lists['access'];?>
					</td>
				</tr>
				<tr>
					<td>
					  <?php echo _HEADER_PUBLISHED;?>:
					</td>
					<td>
					  <?php echo $lists['published'];?>
					</td>
				</tr>
				<tr>
					<td valign="top">
					  <?php echo _CATEGORIES__DETAILS;?>:
					</td>
					<td colspan="2">
					<?php 
					// parameters : areaname, content, hidden field, width, height, rows, cols
					editorArea('editor1', $row->description , 'description', '500', '200', '50', '5') ;
        ?>
				    </td>
				</tr>
			   </table>
			</td>
		    </tr>
		</table>

		<input type="hidden" name="option" value="com_medialibrary" />
		<input type="hidden" name="section" value="categories" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="oldtitle" value="<?php echo $row->title ;?>" />
		<input type="hidden" name="id" value="<?php echo $row->id;?>" />
		<input type="hidden" name="sectionid" value="com_medialibrary" />
		<input type="hidden" name="redirect" value="<?php echo $redirect;?>" />
		</form>
		<?php
	}
}




/**
* MediaLibrary Class
* Handles the data from the medialibrary.
*/

class HTML_medialibrary
{

	//show (edit) video
	function editing_video($option,$medialibrary, $media_class, $clist, $wslist, $langlist, $ratinglist, $delete_edocument, $reviews, $type_list)
	{
		global $my, $mosConfig_live_site, $mainframe,$medialibrary_configuration;
		
		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');
		?>		
<script language="javascript" type="text/javascript">
function type_select()
{

    var el = document.forms["adminForm"].elements["task"];
    el.value = "new";

    el = document.getElementById("media_type_field");
    var el2 = document.getElementById("media_type");
    el.value = el2.options[el2.selectedIndex].value;

    el = document.forms["adminForm"];
    el.submit();

    return ;

}

function trim(string) {
	return string.replace(/(^\s+)|(\s+$)/g, "");
}
function submitbutton(pressbutton) {

	var form = document.adminForm;

  var el = document.getElementById("media_type_field");
  el.value = "video";

	if (pressbutton == 'save') {
		if (trim(form.media_type_id.value) == '') {
			alert( "<?php echo _MEDIALIBRARY_ADMIN_INFOTEXT_JS_EDIT_MEDIAID_CHECK; ?>" );
			return;
		} else if ( trim(form.asin_isbn.value) == '') {
			alert( "<?php echo _MEDIALIBRARY_ADMIN_INFOTEXT_JS_EDIT_ISBN_ASIN_CHECK; ?>" );
			return;
		} else if (form.catid.value == '0') {
			alert( "<?php echo _MEDIALIBRARY_ADMIN_INFOTEXT_JS_EDIT_CATEGORY; ?>");
			return;
		} else {
			submitform( pressbutton );
		}
	} else {
		submitform( pressbutton );
	}
}

</script>
		<form action="index2.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">
		<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
      <!-- anton code type -->
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_MEDIA_TYPE;?>:</strong>
      </td>
      <td align="left">
        <?php echo $type_list; ?>
      </td>
    </tr>
    <!-- anton code -->
		<tr>
			<td width="15%" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_VIDEOID;?>:</strong>
			</td>
			<td width="85%" align="left">
				<input class="inputbox" type="text" name="media_type_id" size="20" maxlength="20" value="<?php echo $media_class->video_id;?>" />
			</td>
		</tr>
		<tr>
			<td width="20%" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_ASIN;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="asin_isbn" size="20" maxlength="20" value="<?php echo $media_class->asin;?>" />				
      </td>
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_LANGUAGE;?>:</strong>
      </td>
      <td align="left">
        <?php echo $langlist; ?>
			</td>
		</tr>		
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_CATEGORY;?>:</strong>
			</td>
			<td align="left">
				<?php echo $clist; ?>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_FETCH_INFO;?>:</strong>
			</td>
			<td align="left">
				<?php echo $wslist; ?>
				&nbsp;&nbsp;&nbsp;<img src="../components/com_medialibrary/images/amazon/com-logo.gif" alt="amazon.com" border="0"/>
			 </td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_COMMENT;?>:</strong>
			</td>
			<td align="left">
				<?php
				  editorArea( 'editor1',  $media_class->comment , 'comment', 500, 250, '70', '10' ) ;

				?>
				<!--<textarea name="comment" id="comment" cols="50" rows="25" style="width:800;height:200;"><?php /*echo $row->comment;*/?></textarea>-->
			</td>
		</tr>
		<?php  if( $medialibrary_configuration['emedias']['allow']){ 
		?>	
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_EVIDEO_UPLOAD;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="file" name="edocument_file" value="" size="50" maxlength="250" onClick="document.adminForm.ebook_Url.value ='';"/>    <!-- //+ -->
			</td>
		</tr>		
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_EVIDEO_UPLOAD_URL;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="evideoUrl" value="<?php echo $media_class->evideoURL; ?>" size="50" maxlength="250"/>
			</td>
		</tr>		
		<?php
		}
		if (count($media_class->evideoURL) > 0){
		?>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_EVIDEO_DELETE;?>:</strong>
			</td>
			<td align="left">
				<?php echo $delete_edocument; ?>
			</td>
		</tr>
		<?php
		}
		?>		
		<tr>
			<td colspan="2">			  					
  				<hr size="2" width="100%" />
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">&nbsp;
			</td>
			<td align="left">
				<?php echo _MEDIALIBRARY_ADMIN_TEXT_WSINFO_TEXT1;?>
				<strong>
				<?php echo _MEDIALIBRARY_LABEL_FETCH_INFO;?>
				->
				<?php echo _MEDIALIBRARY_WS_NO;?>
				</strong>
			</td>
		</tr>	
			<!-- anton code type -->
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_TITLE;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="title" size="80" value="<?php echo $media_class->title;?>" />
			</td>
		</tr>
		<!-- ***********block video************* -->
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _RELEASE_DATA;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="release_date" size="80" value="<?php echo $media_class->release_date;?>" />
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_ACTORS;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="actors" size="80" value="<?php echo $media_class->actors;?>" />
			</td>
		</tr>		
		<tr >
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_STUDIO;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="studio" size="80" value="<?php echo $media_class->studio;?>" />
			</td>
		</tr>	
		<tr >
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_PRODUCER;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="producers" size="80" value="<?php echo $media_class->producers;?>" />
			</td>
		</tr>	
		<tr >
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_DIRECTOR;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="directors" size="80" value="<?php echo $media_class->directors;?>" />
			</td>
		</tr>	
		<tr >
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_REGION;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="region" size="80" value="<?php echo $media_class->region;?>" />
			</td>
		</tr>
		<tr  >
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_NUMBER_OF_DISCS;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="number_of_discs" size="80" value="<?php echo $media_class->number_of_discs;?>" />
			</td>
		</tr>	
		<tr >
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_RUNTIME;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="run_time" size="80" value="<?php echo $media_class->run_time;?>" />
			</td>
		</tr>	
		<tr  >
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_FORMAT;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="video_format" size="80" value="<?php echo $media_class->format;?>" />
			</td>
		</tr>	
		<!-- ***********block************* -->	
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_PRICE;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="price" size="15" value="<?php echo $media_class->price;?>" />
			</td>
		</tr>		
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_RATING;?>:</strong>
      </td>
      <td align="left">
        <?php echo $ratinglist; ?>
      </td>       
    </tr> 
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_PICTURE_URL;?>:</strong>
      </td>
      <!-- /////////////////////////////ANTON CODE///////////////////-->
            <!-- /////////////////////////////Begin AddPatch CODE///////////////////-->           
      <td align="left">
        <input class="inputbox" type="text" name="imageURL" size="80" 
          value="<?php echo $media_class->imageURL;?>" />       
        <input class="inputbox" type="button" name="default_patch" 
          value="Set Local Cover Path" onClick="build_patch()" />
        
        <script type="text/javascript" language="javascript">
        function build_patch()
        {
          var asin_isbn = document.adminForm.asin_isbn.value;
          var url = 'components/com_medialibrary/asin_isbn_build.php';
          <?php $cover_path = $medialibrary_configuration['fetchImages']['location']; ?>
          var cover_path = "<?php echo $cover_path; ?>";
          if (window.XMLHttpRequest)
          {
            // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType)
            {
              http_request.overrideMimeType('text/xml');
            }
          }
          else if (window.ActiveXObject)
          {
            // IE
            try
            {
              http_request = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e)
            {
              try
              {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
              }
              catch (e)
              {}
            }
          }
          if (!http_request)
          {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
          }
          http_request.onreadystatechange = alertContents;
          http_request.open("POST", url, true);
          http_request.setRequestHeader('Content-Type' , 'application/x-www-form-urlencoded');
          http_request.send('asin_isbn='+asin_isbn+'&cover_path='+cover_path);
        }
        function alertContents()
        {
          if (http_request.readyState == 4)
          {
            if (http_request.status == 200)
            {
              if (http_request.responseText == 1)
              {
                alert("<?php echo _MEDIALIBRARY_TOOLBAR_NEW_MEDIA_INCORRECT_FOLDER." ".$cover_path; ?>");
              }
              if (http_request.responseText == false)
              {
                alert("<?php echo _MEDIALIBRARY_TOOLBAR_NEW_MEDIA_INCORRECT_FILE; ?>");
              }
              else
              {
                document.adminForm.imageURL.value = http_request.responseText;
              }
            }
            else
            {
              alert('There was a problem with the request.');
            }
          }
        }
        </script>       
      </td>
      <!-- /////////////////////////////ANTON CODE///////////////////-->
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_PICTURE_URL_UPLOAD;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="file" name="picture_file" value="" size="50" maxlength="250" />
        <br /><?php echo _MEDIALIBRARY_LABEL_PICTURE_URL_DESC;?>
      </td>
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_URL;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="URL" size="80" value="<?php echo $media_class->URL;?>" />
      </td>
    </tr>
    <tr>
      <td colspan="2">&nbsp;
      </td>
    </tr>
<!--*****************   begin change review   ********************************-->
     <?php if ($reviews > false) /*show, if review exist*/
        {?>
    <tr>
      <td colspan="7">
        <hr width="100%" size="2" align="left"> <h3><?php echo _MEDIALIBRARY_LABEL_REVIEWS;?>:</h3> 
      </td>
    </tr>
    <table class="adminlist">
      <tr class="row0">
        <td width="3%" valign="top" align="center">
          <div>#</div>
        </td>
        <td width="2%" valign="top" align="center">
          <div></div>
        </td>
        <td width="10%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_REVIEW_TITLE;?>:</strong>
        </td>
        <td width="10%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_LEND_USER;?>:</strong>
        </td>
        <td width="65%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_REVIEW_COMMENT;?>:</strong>
        </td>
        <td width="5%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_PUB_DATE;?>:</strong>
        </td>
        <td width="5%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_REVIEW_RATING;?>:</strong>
        </td>
      </tr>
    <?php for ($i=0,$nn=1; $i<count($reviews); $i++,$nn++) /*if not one comment*/
        {?>
      <tr class="row0">
        <td valign="top" align="center">
          <div><?php echo $nn;?></div>
        </td>
        <td valign="top" align="center">
          <div>
          <?php echo "<input type='radio' id='cb".$i."' name='bid[]' value='".$medialibrary->id.",".$reviews[$i]->id."' onclick='isChecked(this.checked);' />";   ?>
          </div>
        </td>
        <td valign="top" align="center">
          <div><?php print_r($reviews[$i]->title); ?></div>
        </td>
        <td valign="top" align="left">
          <div><?php print_r($reviews[$i]->name);?></div>
        </td>
        <td valign="top" align="left">
          <div><?php print_r($reviews[$i]->comment);?></div>
        </td>
        <td valign="top" align="left">
          <div><?php print_r($reviews[$i]->date);?></div>
        </td>
        <td valign="top" align="left">
          <div><img src="../components/com_medialibrary/images/rating-<?php echo $reviews[$i]->rating; ?>.gif" alt="<?php echo ($reviews->rating[$i])/2; ?>" border="0" align="right"/>&nbsp;</div>
        </td>
      </tr>
        <?php }/*end for(...)*/?>

    </table>
  <?php }/*end if(...)*/?>

    </table>

    <input type="hidden" name="id" value="<?php echo $medialibrary->id; ?>" />
    <input type="hidden" name="media_id" value="<?php echo $media_class->id; ?>" />
    <input type="hidden" name="option" value="<?php echo $option;?>" />
    <input type="hidden" id="media_type_field" name="media_type" value="" />        
    <input type="hidden" name="boxchecked" value="0" />
    <input type="hidden" name="task" value="" />        
    </form>
<!--
//************************   end change review   ******************************
-->
    <?php
  }
	
	
	//show(edit) music
	function editing_music($option,$medialibrary, $media_class, $clist, $wslist,$langlist, $ratinglist, $delete_edocument, $reviews, $type_list)
	{
    global $my, $mosConfig_live_site, $mainframe,$medialibrary_configuration;
    
    $mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');
    ?>    
<script language="javascript" type="text/javascript">
function type_select()
{
    var el = document.forms["adminForm"].elements["task"];
    el.value = "new";

    el = document.getElementById("media_type_field");
    var el2 = document.getElementById("media_type");
    el.value = el2.options[el2.selectedIndex].value;

    el = document.forms["adminForm"];
    el.submit();

    return ;

}

function trim(string) {
  return string.replace(/(^\s+)|(\s+$)/g, "");
}
function submitbutton(pressbutton) {

  var form = document.adminForm;

  var el = document.getElementById("media_type_field");
  el.value = "music";

  if (pressbutton == 'save') {
    if (trim(form.media_type_id.value) == '') {
      alert( "<?php echo _MEDIALIBRARY_ADMIN_INFOTEXT_JS_EDIT_MEDIAID_CHECK; ?>" );
      return;
    } else if ( trim(form.asin_isbn.value) == '') {
      alert( "<?php echo _MEDIALIBRARY_ADMIN_INFOTEXT_JS_EDIT_ISBN_ASIN_CHECK; ?>" );
      return;
    } else if (form.catid.value == '0') {
      alert( "<?php echo _MEDIALIBRARY_ADMIN_INFOTEXT_JS_EDIT_CATEGORY; ?>");
      return;
    } else {
      submitform( pressbutton );
    }
  } else {
    submitform( pressbutton );
  }
}
</script>
    <form action="index2.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">
    <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
      <!-- anton code type -->
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_MEDIA_TYPE;?>:</strong>
      </td>
      <td align="left">
        <?php echo $type_list; ?>
      </td>
    </tr>
    <!-- anton code -->
    <tr>
      <td width="15%" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_MUSICID;?>:</strong>
      </td>
      <td width="85%" align="left">
        <input class="inputbox" type="text" name="media_type_id" size="20" maxlength="20" value="<?php echo $media_class->music_id;?>" />
      </td>
    </tr>
    <tr>
      <td width="20%" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_ASIN;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="asin_isbn" size="20" maxlength="20" value="<?php echo $media_class->asin;?>" />       
      </td>
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_LANGUAGE;?>:</strong>
      </td>
      <td align="left">
        <?php echo $langlist; ?>
      </td>
    </tr>   
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_CATEGORY;?>:</strong>
      </td>
      <td align="left">
        <?php echo $clist; ?>
      </td>
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_FETCH_INFO;?>:</strong>
      </td>
      <td align="left">
        <?php echo $wslist; ?>
        &nbsp;&nbsp;&nbsp;<img src="../components/com_medialibrary/images/amazon/com-logo.gif" alt="amazon.com" border="0"/>
       </td>
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_COMMENT;?>:</strong>
      </td>
      <td align="left">
        <?php
          editorArea( 'editor1',  $media_class->comment , 'comment', 500, 250, '70', '10' ) ;
        ?>
        <!--<textarea name="comment" id="comment" cols="50" rows="25" style="width:800;height:200;"><?php /*echo $row->comment;*/?></textarea>-->
      </td>
    </tr>
    <?php  if( $medialibrary_configuration['emedias']['allow']){ 
    ?>  
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_EMUSIC_UPLOAD;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="file" name="edocument_file" value="" size="50" maxlength="250" onClick="document.adminForm.ebook_Url.value ='';"/>    <!-- //+ -->
      </td>
    </tr>   
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_EMUSIC_UPLOAD_URL;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="emusic_Url" value="<?php echo $media_class->emusicURL; ?>" size="50" maxlength="250"/>
      </td>
    </tr>   
    <?php
    }
    if (count($media_class->emusicURL) > 0){
    ?>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_EMUSIC_DELETE;?>:</strong>
      </td>
      <td align="left">
        <?php echo $delete_edocument; ?>
      </td>
    </tr>
    <?php
    }
    ?>    
    <tr>
      <td colspan="2">                  
          <hr size="2" width="100%" />
      </td>
    </tr>
    <tr>
      <td valign="top" align="right">&nbsp;
      </td>
      <td align="left">
        <?php echo _MEDIALIBRARY_ADMIN_TEXT_WSINFO_TEXT1;?>
        <strong>
        <?php echo _MEDIALIBRARY_LABEL_FETCH_INFO;?>
        ->
        <?php echo _MEDIALIBRARY_WS_NO;?>
        </strong>
      </td>
    </tr> 
      <!-- anton code type -->
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_TITLE;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="title" size="80" value="<?php echo $media_class->title;?>" />
      </td>
    </tr>
    <!-- ***********block music************* -->
    <tr >
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_ARTIST;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="artist" size="80" value="<?php echo $media_class->artist;?>" />
      </td>
    </tr>
    <tr  >
      <td valign="top" align="right">
        <strong><?php echo _RELEASE_DATA;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="release_date" size="80" value="<?php echo $media_class->release_date;?>" />
      </td>
    </tr>
    <tr >
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_NUMBER_OF_DISCS;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="number_of_discs" size="80" value="<?php echo $media_class->number_of_discs;?>" />
      </td>
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_LABEL;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="label" size="80" value="<?php echo $media_class->label;?>" />
      </td>
    </tr>
    <tr >
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_BINDING;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="binding" size="80" value="<?php echo $media_class->binding;?>" />
      </td>
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_TRACKLIST;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="tracklist" size="80" value="<?php echo $media_class->tracklist;?>" />
      </td>
    </tr>   
  
    <!-- ***********block************* -->  
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_PRICE;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="price" size="15" value="<?php echo $media_class->price;?>" />
      </td>
    </tr>   
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_RATING;?>:</strong>
      </td>
      <td align="left">
        <?php echo $ratinglist; ?>
      </td>       
    </tr> 
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_PICTURE_URL;?>:</strong>
      </td>
      <!-- /////////////////////////////ANTON CODE///////////////////-->
          <!-- /////////////////////////////Begin AddPatch CODE///////////////////-->           
      <td align="left">
        <input class="inputbox" type="text" name="imageURL" size="80" 
          value="<?php echo $media_class->imageURL;?>" />       
        <input class="inputbox" type="button" name="default_patch" 
          value="Set Local Cover Path" onClick="build_patch()" />
        
        <script type="text/javascript" language="javascript">
        function build_patch()
        {
          var asin_isbn = document.adminForm.asin_isbn.value;
          var url = 'components/com_medialibrary/asin_isbn_build.php';
          <?php $cover_path = $medialibrary_configuration['fetchImages']['location']; ?>
          var cover_path = "<?php echo $cover_path; ?>";
          if (window.XMLHttpRequest)
          {
            // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType)
            {
              http_request.overrideMimeType('text/xml');
            }
          }
          else if (window.ActiveXObject)
          {
            // IE
            try
            {
              http_request = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e)
            {
              try
              {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
              }
              catch (e)
              {}
            }
          }
          if (!http_request)
          {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
          }
          http_request.onreadystatechange = alertContents;
          http_request.open("POST", url, true);
          http_request.setRequestHeader('Content-Type' , 'application/x-www-form-urlencoded');
          http_request.send('asin_isbn='+asin_isbn+'&cover_path='+cover_path);
        }
        function alertContents()
        {
          if (http_request.readyState == 4)
          {
            if (http_request.status == 200)
            {
              if (http_request.responseText == 1)
              {
                alert("<?php echo _MEDIALIBRARY_TOOLBAR_NEW_MEDIA_INCORRECT_FOLDER." ".$cover_path; ?>");
              }
              if (http_request.responseText == false)
              {
                alert("<?php echo _MEDIALIBRARY_TOOLBAR_NEW_MEDIA_INCORRECT_FILE; ?>");
              }
              else
              {
                document.adminForm.imageURL.value = http_request.responseText;
              }
            }
            else
            {
              alert('There was a problem with the request.');
            }
          }
        }
        </script>       
      </td>
      <!-- /////////////////////////////ANTON CODE///////////////////-->
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_PICTURE_URL_UPLOAD;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="file" name="picture_file" value="" size="50" maxlength="250" />
        <br /><?php echo _MEDIALIBRARY_LABEL_PICTURE_URL_DESC;?>
      </td>
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_URL;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="URL" size="80" value="<?php echo $media_class->URL;?>" />
      </td>
    </tr>
    <tr>
      <td colspan="2">&nbsp;
      </td>
    </tr>
<!-- **********************   begin change review   ***************************-->
     <?php if ($reviews > false) /*show, if review exist*/
        {?>
    <tr>
      <td colspan="7">
        <hr width="100%" size="2" align="left"> <h3><?php echo _MEDIALIBRARY_LABEL_REVIEWS;?>:</h3> 
      </td>
    </tr>
    <table class="adminlist">
      <tr class="row0">
        <td width="3%" valign="top" align="center">
          <div>#</div>
        </td>
        <td width="2%" valign="top" align="center">
          <div></div>
        </td>
        <td width="10%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_REVIEW_TITLE;?>:</strong>
        </td>
        <td width="10%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_LEND_USER;?>:</strong>
        </td>
        <td width="65%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_REVIEW_COMMENT;?>:</strong>
        </td>
        <td width="5%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_PUB_DATE;?>:</strong>
        </td>
        <td width="5%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_REVIEW_RATING;?>:</strong>
        </td>
      </tr>
    <?php for ($i=0,$nn=1; $i<count($reviews); $i++,$nn++) /*if not one comment*/
        {?>
      <tr class="row0">
        <td valign="top" align="center">
          <div><?php echo $nn;?></div>
        </td>
        <td valign="top" align="center">
          <div>
          <?php echo "<input type='radio' id='cb".$i."' name='bid[]' value='".$medialibrary->id.",".$reviews[$i]->id."' onclick='isChecked(this.checked);' />";   ?>
          </div>
        </td>
        <td valign="top" align="center">
          <div><?php print_r($reviews[$i]->title); ?></div>
        </td>
        <td valign="top" align="left">
          <div><?php print_r($reviews[$i]->name);?></div>
        </td>
        <td valign="top" align="left">
          <div><?php print_r($reviews[$i]->comment);?></div>
        </td>
        <td valign="top" align="left">
          <div><?php print_r($reviews[$i]->date);?></div>
        </td>
        <td valign="top" align="left">
          <div><img src="../components/com_medialibrary/images/rating-<?php echo $reviews[$i]->rating; ?>.gif" alt="<?php echo ($reviews->rating[$i])/2; ?>" border="0" align="right"/>&nbsp;</div>
        </td>
      </tr>
        <?php }/*end for(...)*/?>

    </table>
  <?php }/*end if(...)*/?>

    </table>

    <input type="hidden" name="id" value="<?php echo $medialibrary->id; ?>" />
    <input type="hidden" name="media_id" value="<?php echo $media_class->id; ?>" />
    <input type="hidden" name="option" value="<?php echo $option;?>" />
    <input type="hidden" id="media_type_field" name="media_type" value="" />        
    <input type="hidden" name="boxchecked" value="0" />
    <input type="hidden" name="task" value="" />        
    </form>
<!--*********************   end change review   **************************-->
    <?php
  }



//------------------------------------------------------------------------------	
	// show(edit) game
	function editing_game($option,$medialibrary, $media_class, $clist, $wslist,$langlist, $ratinglist, $delete_edocument, $reviews, $type_list)
	{
    global $my, $mosConfig_live_site, $mainframe,$medialibrary_configuration;
    
    $mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');
    ?>    
<script language="javascript" type="text/javascript">
function type_select()
{
    var el = document.forms["adminForm"].elements["task"];
    el.value = "new";

    el = document.getElementById("media_type_field");
    var el2 = document.getElementById("media_type");
    el.value = el2.options[el2.selectedIndex].value;

    el = document.forms["adminForm"];
    el.submit();

    return ;

}

function trim(string) {
  return string.replace(/(^\s+)|(\s+$)/g, "");
}
function submitbutton(pressbutton) {

  var form = document.adminForm;

  var el = document.getElementById("media_type_field");
  el.value = "game";

  if (pressbutton == 'save') {
    if (trim(form.media_type_id.value) == '') {
      alert( "<?php echo _MEDIALIBRARY_ADMIN_INFOTEXT_JS_EDIT_MEDIAID_CHECK; ?>" );
      return;
    } else if ( trim(form.asin_isbn.value) == '') {
      alert( "<?php echo _MEDIALIBRARY_ADMIN_INFOTEXT_JS_EDIT_ISBN_ASIN_CHECK; ?>" );
      return;
    } else if (form.catid.value == '0') {
      alert( "<?php echo _MEDIALIBRARY_ADMIN_INFOTEXT_JS_EDIT_CATEGORY; ?>");
      return;
    } else {
      submitform( pressbutton );
    }

  } else {
    submitform( pressbutton );
  }
}
</script>
    <form action="index2.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">
    <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
      <!-- anton code type -->
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_MEDIA_TYPE;?>:</strong>
      </td>
      <td align="left">
        <?php echo $type_list; ?>
      </td>
    </tr>
    <!-- anton code -->
    <tr>
      <td width="15%" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_GAMEID;?>:</strong>
      </td>
      <td width="85%" align="left">
        <input class="inputbox" type="text" name="media_type_id" size="20" maxlength="20" value="<?php echo $media_class->game_id;?>" />
      </td>
    </tr>
    <tr>
      <td width="20%" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_ASIN;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="asin_isbn" size="20" maxlength="20" value="<?php echo $media_class->asin;?>" />       
      </td>
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_LANGUAGE;?>:</strong>
      </td>
      <td align="left">
        <?php echo $langlist; ?>
      </td>
    </tr>   
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_CATEGORY;?>:</strong>
      </td>
      <td align="left">
        <?php echo $clist; ?>
      </td>
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_FETCH_INFO;?>:</strong>
      </td>
      <td align="left">
        <?php echo $wslist; ?>
        &nbsp;&nbsp;&nbsp;<img src="../components/com_medialibrary/images/amazon/com-logo.gif" alt="amazon.com" border="0"/>
       </td>
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_COMMENT;?>:</strong>
      </td>
      <td align="left">
        <?php
          editorArea( 'editor1',  $media_class->comment , 'comment', 500, 250, '70', '10' ) ;

        ?>
        <!--<textarea name="comment" id="comment" cols="50" rows="25" style="width:800;height:200;"><?php /*echo $row->comment;*/?></textarea>-->
      </td>
    </tr>
    <?php  if( $medialibrary_configuration['emedias']['allow']){ 
    ?>  
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_EGAME_UPLOAD;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="file" name="edocument_file" value="" size="50" maxlength="250" onClick="document.adminForm.ebook_Url.value ='';"/>    <!-- //+ -->
      </td>
    </tr>   
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_EGAME_UPLOAD_URL;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="egameURL" value="<?php echo $media_class->egameURL; ?>" size="50" maxlength="250"/>
      </td>
    </tr>   
    <?php
    }
    if (count($media_class->egameURL) > 0){
    ?>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_EGAME_DELETE;?>:</strong>
      </td>
      <td align="left">
        <?php echo $delete_edocument; ?>
      </td>
    </tr>
    <?php
    }
    ?>    
    <tr>
      <td colspan="2">                  
          <hr size="2" width="100%" />
      </td>
    </tr>
    <tr>
      <td valign="top" align="right">&nbsp;
      </td>
      <td align="left">
        <?php echo _MEDIALIBRARY_ADMIN_TEXT_WSINFO_TEXT1;?>
        <strong>
        <?php echo _MEDIALIBRARY_LABEL_FETCH_INFO;?>
        ->
        <?php echo _MEDIALIBRARY_WS_NO;?>
        </strong>
      </td>
    </tr> 
      <!-- anton code type -->
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_TITLE;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="title" size="80" value="<?php echo $media_class->title;?>" />
      </td>
    </tr>
    <!-- ***********block game************* -->
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_STUDIO;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="studio" size="80" value="<?php echo $media_class->studio;?>" />
      </td>
    </tr> 
    <tr>
      <td valign="top" align="right"><!-- ***********block************* -->
        <strong><?php echo _MEDIALIBRARY_LABEL_BINDING;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="binding" size="80" value="<?php echo $media_class->binding;?>" />
      </td>
    </tr>

    <tr>
      <td valign="top" align="right"><!-- ***********block************* -->
        <strong><?php echo _RELEASE_DATA?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="release_date" size="80" value="<?php echo $media_class->release_date;?>" />
      </td>
    </tr>

    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_PLATFORM;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="platform" size="80" value="<?php echo $media_class->platform;?>" />
      </td>
    </tr>     
    <!-- ***********block************* -->  
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_PRICE;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="price" size="15" value="<?php echo $media_class->price;?>" />
      </td>
    </tr>   
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_RATING;?>:</strong>
      </td>
      <td align="left">
        <?php echo $ratinglist; ?>
      </td>       
<!--    </tr> -->
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_PICTURE_URL;?>:</strong>
      </td>
      <!-- /////////////////////////////ANTON CODE///////////////////-->
          <!-- /////////////////////////////Begin AddPatch CODE///////////////////-->           
      <td align="left">
        <input class="inputbox" type="text" name="imageURL" size="80" 
          value="<?php echo $media_class->imageURL;?>" />       
        <input class="inputbox" type="button" name="default_patch" 
          value="Set Local Cover Path" onClick="build_patch()" />
        
        <script type="text/javascript" language="javascript">
        function build_patch()
        {
          var asin_isbn = document.adminForm.asin_isbn.value;
          var url = 'components/com_medialibrary/asin_isbn_build.php';
          <?php $cover_path = $medialibrary_configuration['fetchImages']['location']; ?>
          var cover_path = "<?php echo $cover_path; ?>";
          if (window.XMLHttpRequest)
          {
            // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType)
            {
              http_request.overrideMimeType('text/xml');
            }
          }
          else if (window.ActiveXObject)
          {
            // IE
            try
            {
              http_request = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e)
            {
              try
              {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
              }
              catch (e)
              {}
            }
          }
          if (!http_request)
          {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
          }
          http_request.onreadystatechange = alertContents;
          http_request.open("POST", url, true);
          http_request.setRequestHeader('Content-Type' , 'application/x-www-form-urlencoded');
          http_request.send('asin_isbn='+asin_isbn+'&cover_path='+cover_path);
        }
        function alertContents()
        {
          if (http_request.readyState == 4)
          {
            if (http_request.status == 200)
            {
              if (http_request.responseText == 1)
              {
                alert("<?php echo _MEDIALIBRARY_TOOLBAR_NEW_MEDIA_INCORRECT_FOLDER." ".$cover_path; ?>");
              }
              if (http_request.responseText == false)
              {
                alert("<?php echo _MEDIALIBRARY_TOOLBAR_NEW_MEDIA_INCORRECT_FILE; ?>");
              }
              else
              {
                document.adminForm.imageURL.value = http_request.responseText;
              }
            }
            else
            {
              alert('There was a problem with the request.');
            }
          }
        }
        </script>       
      </td>
      <!-- /////////////////////////////ANTON CODE///////////////////-->
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_PICTURE_URL_UPLOAD;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="file" name="picture_file" value="" size="50" maxlength="250" />
        <br /><?php echo _MEDIALIBRARY_LABEL_PICTURE_URL_DESC;?>
      </td>
    </tr>
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_URL;?>:</strong>
      </td>
      <td align="left">
        <input class="inputbox" type="text" name="URL" size="80" value="<?php echo $media_class->URL;?>" />
      </td>
    </tr>
    <tr>
      <td colspan="2">&nbsp;
      </td>
    </tr>
<!-- **********************   begin change review   ***************************-->
     <?php if ($reviews > false) /*show, if review exist*/
        {?>
    <tr>
      <td colspan="7">
        <hr width="100%" size="2" align="left"> <h3><?php echo _MEDIALIBRARY_LABEL_REVIEWS;?>:</h3> 
      </td>
    </tr>
    <table class="adminlist">
      <tr class="row0">
        <td width="3%" valign="top" align="center">
          <div>#</div>
        </td>
        <td width="2%" valign="top" align="center">
          <div></div>
        </td>
        <td width="10%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_REVIEW_TITLE;?>:</strong>
        </td>
        <td width="10%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_LEND_USER;?>:</strong>
        </td>
        <td width="65%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_REVIEW_COMMENT;?>:</strong>
        </td>
        <td width="5%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_PUB_DATE;?>:</strong>
        </td>
        <td width="5%" valign="top" align="center">
          <strong><?php echo _MEDIALIBRARY_LABEL_REVIEW_RATING;?>:</strong>
        </td>
      </tr>
    <?php for ($i=0,$nn=1; $i<count($reviews); $i++,$nn++) /*if not one comment*/
        {?>
      <tr class="row0">
        <td valign="top" align="center">
          <div><?php echo $nn;?></div>
        </td>
        <td valign="top" align="center">
          <div>
          <?php echo "<input type='radio' id='cb".$i."' name='bid[]' value='".$medialibrary->id.",".$reviews[$i]->id."' onclick='isChecked(this.checked);' />";   ?>
          </div>
        </td>
        <td valign="top" align="center">
          <div><?php print_r($reviews[$i]->title); ?></div>
        </td>
        <td valign="top" align="left">
          <div><?php print_r($reviews[$i]->name);?></div>
        </td>
        <td valign="top" align="left">
          <div><?php print_r($reviews[$i]->comment);?></div>
        </td>
        <td valign="top" align="left">
          <div><?php print_r($reviews[$i]->date);?></div>
        </td>
        <td valign="top" align="left">
          <div><img src="../components/com_medialibrary/images/rating-<?php echo $reviews[$i]->rating; ?>.gif" alt="<?php echo ($reviews->rating[$i])/2; ?>" border="0" align="right"/>&nbsp;</div>
        </td>
      </tr>
        <?php }/*end for(...)*/?>

    </table>
  <?php }/*end if(...)*/?>

    </table>

    <input type="hidden" name="id" value="<?php echo $medialibrary->id; ?>" />
    <input type="hidden" name="media_id" value="<?php echo $media_class->id; ?>" />
    <input type="hidden" name="option" value="<?php echo $option;?>" />
    <input type="hidden" id="media_type_field" name="media_type" value="" />        
    <input type="hidden" name="boxchecked" value="0" />
    <input type="hidden" name="task" value="" />        
    </form>
<!--*********************   end change review   **************************-->
    <?php
  }



//-------------------------------------------------------------------------------------
	// show(edit) book
	function editing_book($option,$medialibrary, $media_class, $clist, $wslist, $langlist, $ratinglist, $delete_edocument, $reviews, $type_list)
	{
		global $my, $mosConfig_live_site, $mainframe,$medialibrary_configuration;
		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');
?>
<script language="javascript" type="text/javascript">
function type_select()
{
    var el = document.forms["adminForm"].elements["task"];
    el.value = "new";

    el = document.getElementById("media_type_field");
    var el2 = document.getElementById("media_type");
    el.value = el2.options[el2.selectedIndex].value;

    el = document.forms["adminForm"];
    el.submit();

    return ;    
}

function trim(string) {
	return string.replace(/(^\s+)|(\s+$)/g, "");
}
function submitbutton(pressbutton) {

	var form = document.adminForm;


	if (pressbutton == 'save') {

    var el = document.getElementById("media_type_field");
    el.value = "book";
		if (trim(form.media_type_id.value) == '') {
			alert( "<?php echo _MEDIALIBRARY_ADMIN_INFOTEXT_JS_EDIT_MEDIAID_CHECK; ?>" );
			return;
		} else if ( trim(form.asin_isbn.value) == '') {
			alert( "<?php echo _MEDIALIBRARY_ADMIN_INFOTEXT_JS_EDIT_ISBN_ASIN_CHECK; ?>" );
			return;
		} else if (form.catid.value == '0') {
			alert( "<?php echo _MEDIALIBRARY_ADMIN_INFOTEXT_JS_EDIT_CATEGORY; ?>");
			return;
		} else {
			submitform( pressbutton );
		}
	} else {
		submitform( pressbutton );
	}
}
</script>


		<form action="index2.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">
		<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
      <!-- anton code type -->
    <tr>
      <td valign="top" align="right">
        <strong><?php echo _MEDIALIBRARY_LABEL_MEDIA_TYPE;?>:</strong>
      </td>
      <td align="left">
        <?php echo $type_list; ?>
      </td>
    </tr>
    <!-- anton code -->
		<tr>
			<td width="15%" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_BOOKID;?>:</strong>
			</td>
			<td width="85%" align="left">
				<input class="inputbox" type="text" name="media_type_id" size="20" maxlength="20" value="<?php echo $media_class->book_id; ?>" />
			</td>
		</tr>
		<tr>
			<td width="20%" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_ISBN;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="asin_isbn" size="20" maxlength="20" value="<?php echo $media_class->isbn;?>" />				
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_LANGUAGE;?>:</strong>
			</td>
			<td align="left">
				<?php echo $langlist; ?>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_CATEGORY;?>:</strong>
			</td>
			<td align="left">
				<?php echo $clist; ?>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_FETCH_INFO;?>:</strong>
			</td>
			<td align="left">
				<?php echo $wslist; ?>
				&nbsp;&nbsp;&nbsp;<img src="../components/com_medialibrary/images/amazon/com-logo.gif" alt="amazon.com" border="0"/>
			 </td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_COMMENT;?>:</strong>
			</td>
			<td align="left">
				<?php
   				editorArea( 'editor1',  $media_class->comment , 'comment', 500, 250, '70', '10' ) ;
				?>
				<!--<textarea name="comment" id="comment" cols="50" rows="25" style="width:800;height:200;"><?php /*echo $row->comment;*/?></textarea>-->
			</td>
		</tr>
		<?php if ($medialibrary_configuration['emedias']['allow']){
		?>	
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_EMEDIA_UPLOAD;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="file" name="edocument_file" value="" size="50" maxlength="250" onClick="document.adminForm.ebook_Url.value ='';"/>    <!-- //+ -->
			</td>
		</tr>		
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_EMEDIA_UPLOAD_URL;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="ebook_Url" value="<?php echo $media_class->ebookURL; ?>" size="50" maxlength="250"/>
			</td>
		</tr>		
		<?php
		}
		if (count($media_class->ebookURL) > 0){
		?>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_EMEDIA_DELETE;?>:</strong>
			</td>
			<td align="left">
				<?php echo $delete_edocument; ?>
			</td>
		</tr>
		<?php
		}
		?>		
		<tr>
			<td colspan="2">			  					
  				<hr size="2" width="100%" />
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">&nbsp;
			</td>
			<td align="left">
				<?php echo _MEDIALIBRARY_ADMIN_TEXT_WSINFO_TEXT1;?>
				<strong>
				<?php echo _MEDIALIBRARY_LABEL_FETCH_INFO;?>
				->
				<?php echo _MEDIALIBRARY_WS_NO;?>
				</strong>
			</td>
		</tr>	
			<!-- anton code type -->
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_TITLE;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="title" size="80" value="<?php echo $media_class->title;?>" />
			</td>
		</tr>
		<!-- ***********block book************* -->
		<tr >
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_AUTHORS;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="authors" size="80" value="<?php echo $media_class->authors;?>" />
			</td>
		</tr>		
		<tr >
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_MANUFACTURER;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="manufacturer" size="80" value="<?php echo $media_class->manufacturer;?>" />
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_PUB_DATE;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="release_date" size="30" value="<?php echo $media_class->release_date;?>" />				
			</td>
		</tr>
		
		<!-- ***********block************* -->	
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_PRICE;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="price" size="15" value="<?php echo $media_class->price;?>" />
			</td>
		</tr>		
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_RATING;?>:</strong>
			</td>
			<td align="left">
				<?php echo $ratinglist; ?>
			</td>				
		</tr> 
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_PICTURE_URL;?>:</strong>
			</td>
			<!-- /////////////////////////////ANTON CODE///////////////////-->
            <!-- /////////////////////////////Begin AddPatch CODE///////////////////-->           
			<td align="left">

				<input class="inputbox" type="text" name="imageURL" size="80" value="<?php echo $media_class->imageURL;?>" />				
				<input class="inputbox" type="button" name="default_patch" value="Set Local Cover Path" onClick="build_patch()" />
				
				<script type="text/javascript" language="javascript">
				function build_patch()
				{
					var asin_isbn = document.adminForm.asin_isbn.value;
					var url = 'components/com_medialibrary/asin_isbn_build.php';
					<?php $cover_path = $medialibrary_configuration['fetchImages']['location']; ?>
					var cover_path = "<?php echo $cover_path; ?>";
					if (window.XMLHttpRequest)
					{
						// Mozilla, Safari,...
						http_request = new XMLHttpRequest();
						if (http_request.overrideMimeType)
						{
							http_request.overrideMimeType('text/xml');
						}
					}
					else if (window.ActiveXObject)
					{
						// IE
						try
						{
							http_request = new ActiveXObject("Msxml2.XMLHTTP");
						}
						catch (e)
						{
							try
							{
								http_request = new ActiveXObject("Microsoft.XMLHTTP");
							}
							catch (e)
							{}
						}
					}
					if (!http_request)
					{
						alert('Giving up :( Cannot create an XMLHTTP instance');
						return false;
					}
					http_request.onreadystatechange = alertContents;
					http_request.open("POST", url, true);
					http_request.setRequestHeader('Content-Type' , 'application/x-www-form-urlencoded');
					http_request.send('asin_isbn='+asin_isbn+'&cover_path='+cover_path);
				}
				function alertContents()
				{
					if (http_request.readyState == 4)
					{
						if (http_request.status == 200)
						{
							if (http_request.responseText == 1)
							{
								alert("<?php echo _MEDIALIBRARY_TOOLBAR_NEW_MEDIA_INCORRECT_FOLDER." ".$cover_path; ?>");
							}
							if (http_request.responseText == false)
							{
								alert("<?php echo _MEDIALIBRARY_TOOLBAR_NEW_MEDIA_INCORRECT_FILE; ?>");
							}
							else
							{
                document.adminForm.imageURL.value = http_request.responseText;
							}
						}
						else
						{
							alert('There was a problem with the request.');
						}
					}
				}
				</script>				
			</td>
			<!-- /////////////////////////////ANTON CODE///////////////////-->

		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_PICTURE_URL_UPLOAD;?>:</strong>
		    </td>
			<td align="left">
  			<input class="inputbox" type="file" name="picture_file" value="" size="50" maxlength="250" />
  			<br /><?php echo _MEDIALIBRARY_LABEL_PICTURE_URL_DESC;?>
	    </td>
		</tr>
		<tr>
			<td valign="top" align="right">
				<strong><?php echo _MEDIALIBRARY_LABEL_URL;?>:</strong>
			</td>
			<td align="left">
				<input class="inputbox" type="text" name="URL" size="80" value="<?php echo $media_class->URL;?>" />
			</td>
		</tr>
		<tr>
			<td colspan="2">&nbsp;
			</td>
		</tr>
<!--************************   begin change review   **************************-->
     <?php if ($reviews > false) /*show, if review exist*/
	      {?>
		<tr>
			<td colspan="7">
			  <hr width="100%" size="2" align="left"> <h3><?php echo _MEDIALIBRARY_LABEL_REVIEWS;?>:</h3> 
			</td>
		</tr>
		<table class="adminlist">
			<tr class="row0">
				<td width="3%" valign="top" align="center">
					<div>#</div>
				</td>
				<td width="2%" valign="top" align="center">
					<div></div>
				</td>
				<td width="10%" valign="top" align="center">
					<strong><?php echo _MEDIALIBRARY_LABEL_REVIEW_TITLE;?>:</strong>
				</td>
				<td width="10%" valign="top" align="center">
					<strong><?php echo _MEDIALIBRARY_LABEL_LEND_USER;?>:</strong>
				</td>
				<td width="65%" valign="top" align="center">
					<strong><?php echo _MEDIALIBRARY_LABEL_REVIEW_COMMENT;?>:</strong>
				</td>
				<td width="5%" valign="top" align="center">
					<strong><?php echo _MEDIALIBRARY_LABEL_PUB_DATE;?>:</strong>
				</td>
				<td width="5%" valign="top" align="center">
					<strong><?php echo _MEDIALIBRARY_LABEL_REVIEW_RATING;?>:</strong>
				</td>
			</tr>
	  <?php for ($i=0,$nn=1; $i<count($reviews); $i++,$nn++) /*if not one comment*/
		    {?>
			<tr class="row0">
				<td valign="top" align="center">
					<div><?php echo $nn;?></div>
				</td>
				<td valign="top" align="center">
					<div>
					<?php echo "<input type='radio' id='cb".$i."' name='bid[]' value='".$medialibrary->id.",".$reviews[$i]->id."' onclick='isChecked(this.checked);' />";   ?>
					</div>
				</td>
				<td valign="top" align="center">
					<div><?php print_r($reviews[$i]->title); ?></div>
				</td>
				<td valign="top" align="left">
					<div><?php print_r($reviews[$i]->name);?></div>
				</td>
				<td valign="top" align="left">
					<div><?php print_r($reviews[$i]->comment);?></div>
				</td>
				<td valign="top" align="left">
					<div><?php print_r($reviews[$i]->date);?></div>
				</td>
				<td valign="top" align="left">
					<div><img src="../components/com_medialibrary/images/rating-<?php echo $reviews[$i]->rating; ?>.gif" alt="<?php echo ($reviews->rating[$i])/2; ?>" border="0" align="right"/>&nbsp;</div>
				</td>
			</tr>
	      <?php }/*end for(...)*/?>

		</table>
	<?php }/*end if(...)*/?>

		</table>

    <input type="hidden" name="id" value="<?php echo $medialibrary->id; ?>" />
    <input type="hidden" name="media_id" value="<?php echo $media_class->id; ?>" />
		<input type="hidden" name="option" value="<?php echo $option;?>" />
    <input type="hidden" id="media_type_field" name="media_type" value="" />        
    <input type="hidden" name="boxchecked" value="0" />
    <input type="hidden" name="task" value="" />        
		</form>
<!--
//************************   end change review   ******************************
-->
		<?php
	}

	function edit_review($option, $book_id, &$review) {

		global $my, $mosConfig_live_site,$mainframe;
		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');
?>
		<form action="index2.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">

		<table cellpadding="4" cellspacing="5" border="0" width="100%" class="adminform">
    	<tr>
      	<td colspan="2">
	        <?php echo _MEDIALIBRARY_LABEL_REVIEW_TITLE; ?>
        </td>
      </tr>
      <tr>
        <td colspan="2">
           <input class="inputbox" type="text" name="title" size="80" 
							value="<?php echo $review[0]->title ?>" />
        </td>
      </tr>
      <tr>
        <td>
            <?php echo _MEDIALIBRARY_LABEL_REVIEW_COMMENT; ?>
        </td>
        <td align="left" >
           <?php echo _MEDIALIBRARY_LABEL_REVIEW_RATING; ?>
        </td>
      </tr>
      <tr>
        <td>
         <!--<textarea align="top" name="comment" id="comment" cols="60" rows="10" style="width:400;height:100;"/></textarea>-->
           <?php
           editorArea( 'editor1',  $review[0]->comment , 'comment', '410', '200', '60', '10' );
            ?>
        </td>
				<td width="102" align='left'>
           <?php
           $k = 0;
           while($k < 11){
           ?>
            <input type="radio" name="rating" value="<?php echo $k; ?>" 
                     <?php if($k == $review[0]->rating ) echo 'checked="checked"'; ?> alt="Rating" />
           
            <img src="../components/com_medialibrary/images/rating-<?php echo $k; ?>.gif" 
							alt="<?php echo ($k)/2; ?>" border="0" /><br />
           <?php
           $k ++;
           }
           ?>
         </td>
       </tr>
       <tr>
	       <td colspan="2">&nbsp;
	          
         </td>
       </tr>

	  </table>

		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="update_review" />
		<input type="hidden" name="book_id" value="<?php echo $book_id; ?>" />
		<input type="hidden" name="review_id" value="<?php echo $review[0]->id; ?>" />
	</form>
<?php
	}



	//*************   begin for manage reviews   ********************
	function edit_manage_review($option, & $review) {
		global $my, $mosConfig_live_site,$mainframe;
		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');
?>
		<form action="index2.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">
		<table cellpadding="4" cellspacing="5" border="0" width="100%" class="adminform">
    	<tr>
      	<td colspan="2">
	        <?php echo _MEDIALIBRARY_LABEL_REVIEW_TITLE; ?>
        </td>
      </tr>
      <tr>
        <td colspan="2">
           <input class="inputbox" type="text" name="title" size="80" 
							value="<?php echo $review[0]->title ?>" />
        </td>
      </tr>
      <tr>
        <td>
            <?php echo _MEDIALIBRARY_LABEL_REVIEW_COMMENT; ?>
        </td>
        <td align="left" >
           <?php echo _MEDIALIBRARY_LABEL_REVIEW_RATING; ?>
        </td>
      </tr>
      <tr>
        <td>
         <!--<textarea align= "top" name="comment" id="comment" cols="60" rows="10" style="width:400;height:100;"/></textarea>-->

           <?php
           editorArea( 'editor1',  $review[0]->comment , 'comment', '410', '200', '60', '10' ) ;
             ?>
        </td>
				<td width="102" align='left'>
           <?php
           $k = 0;
           while($k < 11){
           ?>
           <input type="radio" name="rating" value="<?php echo $k; ?>" 
							<?php if($k == $review[0]->rating ) echo 'checked="checked"'; ?> alt="Rating" />
           <img src="../components/com_medialibrary/images/rating-<?php echo $k; ?>.gif" 
							alt="<?php echo ($k)/2; ?>" border="0" /><br />
           <?php
           $k ++;
           }
           ?>
         </td>
       </tr>
       <tr>
	       <td colspan="2">&nbsp;
	          
         </td>
       </tr>

	  </table>

		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="update_edit_manage_review" />
		<input type="hidden" name="review_id" value="<?php echo $review[0]->id; ?>" />
	</form>
<?php
	}
	//***************   end for manage reviews   ********************


	function showRequestLendMedias($option, & $lend_requests, & $pageNav)
	{
		global $my, $mosConfig_live_site,$mainframe;
		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.
      $mosConfig_live_site.
      '/administrator/components/com_medialibrary/includes/functions.js"></script>');

		$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.
      $mosConfig_live_site.
      '/administrator/components/com_medialibrary/includes/medialibrary.css" type="text/css" />');
?>

		<form action="index2.php" method="post" name="adminForm">

		<table cellpadding="4" cellspacing="0" border="0" width="100%">
		<tr>
      <td width="30%">
         <img src="./components/com_medialibrary/images/cfg.png" align="right" alt="Config" />
      </td>
      <td width="70%" class="media_manager_caption" valign='bottom' >
				<?php echo _MEDIALIBRARY_ADMIN_REQUEST_LEND; ?>
			</td>
		</tr>
		</table>

		<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
			<tr>
				<th align = "center" width="20">
					<input type="checkbox" name="toggle" value="" 
            onClick="checkAll(<?php echo count( $lend_requests ); ?>);" />
				</th>
				<th align = "center" width="30">#</th>
				<th align = "center" class="title" width="10%" nowrap="nowrap">
          <?php echo _MEDIALIBRARY_LABEL_LEND_FROM;?></th>
				<th align = "center" class="title" width="10%" nowrap="nowrap">
          <?php echo _MEDIALIBRARY_LABEL_LEND_UNTIL;?></th>
				<th align = "center" class="title" width="5%" nowrap="nowrap">
          <?php echo _MEDIALIBRARY_LABEL_MEDIA_TYPE_ID;?></th>
        <th align = "center" class="title" width="10%" nowrap="nowrap">
          <?php echo _MEDIALIBRARY_LABEL_MEDIA_TYPE;?></th>
        <th align = "center" class="title" width="7%" nowrap="nowrap">
          <?php echo _HEADER_CATEGORY;?></th>
				<th align = "center" class="title" width="7%" nowrap="nowrap">
          <?php echo _MEDIALIBRARY_LABEL_TITLE;?></th>
				<th align = "center" class="title" width="15%" nowrap="nowrap">
          <?php echo _MEDIALIBRARY_LABEL_LEND_USER;?></th>
				<th align = "center" class="title" width="15%" nowrap="nowrap">
          <?php echo _MEDIALIBRARY_LABEL_LEND_EMAIL;?></th>
				<th align = "center" class="title" width="20%" nowrap="nowrap">
          <?php echo _MEDIALIBRARY_LABEL_LEND_ADRES;?></th>
			</tr>
<?php

for ($i = 0, $n = count($lend_requests); $i < $n; $i ++) {
	$row = & $lend_requests[$i];
?>
			<tr class="row<?php echo $i % 2; ?>">
				<td width="20">
<?php				if ($row->fk_lendid != 0) { ?>
								&nbsp;
<?php
            } else {
	            echo mosHTML::idBox( $i, $row->id, ($row->fk_lendid != 0), 'bid' );
            }
?>
				</td>
				<td align = "center"><?php echo $row->id; ?></td>
				<td align = "center">
					<?php echo $row->lend_from; ?>
				</td>
				<td align = "center">
					<?php echo $row->lend_until; ?>
				</td>
				<td align = "center"><?php echo $row->media_type_id; ?></td>
        <td align = "center">
          <?php echo $row->media_type; ?>
        </td>
        <td align = "center">
          <?php echo $row->category; ?>
        </td>
				<td align = "center">
					<?php echo $row->title; ?>
				</td>
				<td align = "center">					
					<?php echo $row->user_name; ?>
				</td>
				<td align = "center">
					<a href=mailto:"<?php echo $row->user_email; ?>">
						<?php echo $row->user_email; ?>
					</a>
				</td>
				<td align = "center">
					<?php echo $row->user_mailing; ?>
				</td>
			</tr>
		<?php
}
    ?>
      <tr><td colspan = "11"><?php echo $pageNav->getListFooter();?></td></tr>
		</table>

		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="lend_requests" />
		<input type="hidden" name="boxchecked" value="0" />
		</form>

<?php

	}







	function showMedias($option, & $rows_book, & $clist, & $lendlist, & $publist,&$typelist, & $search, & $pageNav)
	{
		global $my, $mosConfig_live_site,$mainframe,$session;
		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');

		$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/medialibrary.css" type="text/css" />');

		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" language = "JavaScript" >
 function before_print_check()
 {
  var add = document.getElementsByName("bid[]");
  var count=0;    
 
  for(var i=0;i<add.length;i++)
  {
      if(add[i].checked)
        { 
         count++;
         break;
        }
   }

  if(count == 0)
    {
     alert("Please make a selection first"); 
     exit;
    } 
  else
   {
    document.adminForm.target = "_blank" ;
    document.adminForm.task.value="print_medias";
    document.adminForm.submit(); 
   }
}
</script>');
?>
		<form action="index2.php" method="post" name="adminForm">
		<table cellpadding="4" cellspacing="0" border="0" width="100%">
      <tr>
        <td width="30%">
            <img src="./components/com_medialibrary/images/cfg.png" align="right" alt="Config" />
        </td>
	      <td width="68%" class="media_manager_caption" valign='bottom' >
				  <?php echo _MEDIALIBRARY_SHOW;?>
				</td>
        <td width="3%">
        </td>
			</tr>
		</table>

		<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
		<tr>
			<td>
				<?php echo _MEDIALIBRARY_SHOW_SEARCH;?>
			</td>
			<td>
        <input type="text" name="search" value="<?php echo $search;?>" class="inputbox" onChange="document.adminForm.submit();" />
			</td>
			<td>
				<?php echo $publist;?>
			</td>
      <td>
        <?php echo $lendlist;?>
      </td>
      <td>
        <?php echo $typelist;?>
      </td>
			<td >
				<?php echo $clist;?>
			</td>
		</tr>
		</table>

<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
<tr>
  <th width="20">
   <input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count( $rows_book ); ?>);" />
  </th>
  <th width="30">#</th>
  <th align = "center" class="title" width="5%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_MEDIA_TYPE;?></th>
  <th align = "center" class="title" width="27%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_TITLE;?></th>
  <th align = "center" class="title" width="5%" nowrap="nowrap" colspan="2"><?php echo _MEDIALIBRARY_LABEL_LINE;?></th>
  <th align = "center" class="title" width="10%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_FETCH_INFO;?></th>
  <th align = "center" class="title" width="16%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_CATEGORY;?></th>
  <th align = "center" class="title" width="10%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_LEND;?></th>
  <th align = "center" class="title" width="5%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_HITS;?></th>		
  <th align = "center"  class="title" width="5%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_PUBLIC;?></th>
  <th align = "center" class="title" width="5%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_CONTROL;?></th>
</tr>
<?php 

for ($i = 0, $n = count($rows_book); $i < $n; $i ++) {
	$row = & $rows_book[$i];
?>
			<tr class="row<?php echo $i % 2; ?>">

				<td width="20" align="left">
					<?php		if ($row->checked_out && $row->checked_out != $my->id) { ?>
						&nbsp;
<?php
					} else {
						echo mosHTML::idBox( $i, $row->id, ($row->checked_out && $row->checked_out != $my->id ), 'bid' );
					}
?>
				</td>
				<td align = "center" ><?php echo $row->id; ?></td>
				<td align = "center"><?php echo $row->media_type; ?></td>
				<td align="left">
					<a href="#" onClick="return listItemTask('cb<?php echo $i;?>','edit')">
						<?php echo $row->title; ?>
					</a>
				</td>
				<td>
					<?php echo $pageNav->orderUpIcon( $i, ($row->catid == @$rows_book[$i-1]->catid), "bookorderup" ); ?>
				</td>
      				<td>
					<?php echo $pageNav->orderDownIcon( $i, $n, ($row->catid == @$rows_book[$i+1]->catid), "bookorderdown" ); ?>
				</td>
				<td align="center">
					<?php echo mosMedialibraryWS :: getWsNameById($row->informationFrom);?>
				</td>
				<td align = "center"><?php echo $row->category; ?></td>
				<td align = "center">
				<?php
				if ($row->lend_from == null) {
				?>
					<a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>','lend')">
					<img src='./components/com_medialibrary/images/lend_f2.png' align='middle' width='15' height='15' border='0' alt='Lend out' />
						<br />
					</a>
				<?php
				} else {
				?>

				<img src='./components/com_medialibrary/images/lend_return_f2.png' align='middle' width='15' height='15' border='0' alt='Return book' />
				<br />
				<a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>','lend_return')"> 
				<?php echo substr($row->lend_from, 0, 10); ?>
				</a>
			
				<?php		
				}
				?>

				</td>

				<td align = "center"><?php echo $row->hits; ?></td>
			<?php
			$task = $row->published ? 'unpublish' : 'publish';
			$alt = $row->published ? 'Unpublish' : 'Publish';
			$img = $row->published ? 'tick.png' : 'publish_x.png';
			?>
			  <td width="5%" align="center">
			  	<a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')">
				<img src="images/<?php echo $img;?>" width="12" height="12" border="0" alt="<?php echo $alt;?>" />
			  	</a>
			  </td>
			<?php
			if ($row->checked_out) {
			?>
				<td align="center"><?php echo $row->editor; ?></td>
<?php			} else { ?>
				<td align="center">&nbsp;</td>
<?php				} ?>
			</tr>
<?php	
}//end for
?>
                <tr><td colspan = "13"><?php echo $pageNav->getListFooter();?></td>
		</tr>
		</table>
		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		</form>

<?php
	}


//------------------------------------------------------------
	//**********   begin for manage reviews  *****************
	function showManageReviews($option, & $pageNav, & $reviews) {
		global $my, $mosConfig_live_site,$mainframe;
		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.
      $mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');

		$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.
      $mosConfig_live_site.'/administrator/components/com_medialibrary/includes/medialibrary.css" type="text/css" />');
?>
		<form action="index2.php" method="post" name="adminForm">
		<table cellpadding="4" cellspacing="0" border="0" width="100%">
			<tr >
        <td width="30%">
            <img src="./components/com_medialibrary/images/cfg.png" align="right" alt="Config" />
        </td>
	      <td width="70%" class="media_manager_caption" valign='bottom' >
  				<?php echo _MEDIALIBRARY_SHOW_REVIEW_MANAGER;?>
				</td>
			</tr>
		</table>

		<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
		<tr>
		<th width="20">
		  <input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count( $reviews ); ?>);" />
		</th>
		<th align="center" width="30">
       <a href="#numer" onClick="return listItemTask('cb<?php echo "1";?>','sorting_manage_review_numer');">#</a>
    </th>
		<th align="center" class="title" width="12%" nowrap="nowrap">
      <a href="#media_type" 
        onClick="return listItemTask('cb<?php echo "1";?>','sorting_manage_review_media_type');">
        <?php echo _MEDIALIBRARY_LABEL_MEDIA_TYPE;?></a>
    </th>
    <th align="center" class="title" width="25%" nowrap="nowrap">
      <a href="#media_title" 
        onClick="return listItemTask('cb<?php echo "1";?>','sorting_manage_review_media_title');">
        <?php echo _MEDIALIBRARY_LABEL_TITLE;?></a>
    </th>
    <th align="center" class="title" width="16%" nowrap="nowrap">
      <a href="#title_catigory" 
        onClick="return listItemTask('cb<?php echo "1";?>','sorting_manage_review_title_catigory');">
        <?php echo _MEDIALIBRARY_LABEL_CATEGORY;?></a>
    </th>
		<th align="center" class="title" width="25%" nowrap="nowrap">
      <a href="#title_review" 
        onClick="return listItemTask('cb<?php echo "1";?>','sorting_manage_review_title_review');">
        <?php echo _MEDIALIBRARY_LABEL_TITLE_COMMENT;?></a>
    </th>
		<th align="center" class="title" width="7%" nowrap="nowrap">
      <a href="#user_name" 
        onClick="return listItemTask('cb<?php echo "1";?>','sorting_manage_review_user_name');">
        <?php echo _MEDIALIBRARY_LABEL_LEND_USER;?></a>
    </th>
		<th align="center" class="title" width="8%" nowrap="nowrap">
      <a href="#date" 
        onClick="return listItemTask('cb<?php echo "1";?>','sorting_manage_review_date');">
      <?php echo _MEDIALIBRARY_LABEL_PUB_DATE;?></a>
    </th>
		<th align="center" class="title" width="7%" nowrap="nowrap">
      <a href="#rating" 
        onClick="return listItemTask('cb<?php echo "1";?>','sorting_manage_review_rating');">
      <?php echo _MEDIALIBRARY_LABEL_RATING;?></a>
    </th>
	</tr>
<?php

for ($i = 0, $n = count($reviews); $i < $n; $i ++) {
	$row = $reviews[$i];
?>
			<tr class="row<?php echo $i % 2; ?>">
				<td width="20" align="left">
					<input type="checkbox" id="cb<?php echo $i;?>" name="bid[]" value="<?php echo $row->review_id;?>" onClick="isChecked(this.checked);" />
				</td>
				<td align="center" width="30"><?php echo $reviews[$i]->review_id;?></td>
				<td align="center" width="12%"><?php echo $reviews[$i]->media_type; ?></td>
				<td align="center" width="25%"><?php echo $reviews[$i]->media_title;?></td>
				<td align="center" width="16%"><?php echo $reviews[$i]->title_catigory; ?></td>
				<td align="center" width="25%">
					<a href="#edit" onClick="return listItemTask('cb<?php echo $i;?>','edit_manage_review');">
						<?php
						//if 'title_comment' >55 else 'title_comment' -- all
						if ( strlen($reviews[$i]->title_review) > 55 ) {
							for ($j = 0; $j < 55; $j++ ) {echo $reviews[$i]->title_review[$j];}
						} else {echo $reviews[$i]->title_review; /*title comment*/}
						?>
					</a>
				</td>
				<td align="center" width="7%"><?php echo $reviews[$i]->user_name;?></td>
				<td align="center" width="8%"><?php echo $reviews[$i]->date;?></td>
				<td align="center" width="7%">
					<div><img src="../components/com_medialibrary/images/rating-<?php echo $reviews[$i]->rating; ?>.gif" alt="<?php echo ($reviews[$i]->rating)/2; ?>" border="0" align="right"/>&nbsp;</div>
				</td>
			</tr>
		<?php
}//end for(...)


		?>
                <tr><td colspan = "11"><?php echo $pageNav->getListFooter();?></td></tr>
		</table>

		<input type="hidden" name="id" value="<?php echo /*$row->review_id;*/ $row->fk_mediaid; ?>" />
		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="manage_review" />
		<input type="hidden" name="boxchecked" value="0" />
		</form>

<?php
	}
//************   end for manage reviews   ***************************





	/**
* Writes the edit form for new and existing records
*
* A new record is defined when <var>$row</var> is passed with the <var>id</var>
* property set to 0.
* @param mosMediaLibrary The media object
* @param mosMediaType  The media type object
* @param string The html for the categories select list
* @param string The html for the ordering select list*/  
	function editMedia($option,$medialibrary, & $media_class, & $clist, & $wslist, & $langlist, & $ratinglist, & $delete_edocument, & $reviews, & $type_list, & $multimedia_type)
	{
		global $medialibrary_configuration;
		// выборка какой тип отображать
		switch($multimedia_type)
		{
			case 'book':
				HTML_medialibrary::editing_book($option,$medialibrary, $media_class, $clist, $wslist, $langlist, $ratinglist, $delete_edocument, $reviews, $type_list);
				break;
			case 'video':
				HTML_medialibrary::editing_video($option,$medialibrary, $media_class, $clist, $wslist, $langlist, $ratinglist, $delete_edocument, $reviews, $type_list);
				break;
			case 'music':
				HTML_medialibrary::editing_music($option,$medialibrary, $media_class, $clist, $wslist, $langlist, $ratinglist, $delete_edocument, $reviews, $type_list);
				break;
			case 'game':
				HTML_medialibrary::editing_game($option,$medialibrary, $media_class, $clist, $wslist, $langlist, $ratinglist, $delete_edocument, $reviews, $type_list);
				break;
		}
	}

	function showInfoRefetchMedias($option, & $result, & $wslist) {
		global $my, $mosConfig_live_site,$mainframe;
		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');

		global $my;

?>

	<form action="index2.php" method="post" name="adminForm">
	<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
		<tr>
			<td colspan="6">
  			<strong><?php echo _MEDIALIBRARY_LABEL_INFO_FETCH;?></strong>
  		<?php echo $wslist; ?>
  		&nbsp;&nbsp;&nbsp;
          <img src="../components/com_medialibrary/images/amazon/com-logo.gif"
                                  alt="amazon.com" border="0" />
  		 </td>
			</tr>
			<tr>
				<th align = "center" class="title" width="20">
					<?php echo _MEDIALIBRARY_LABEL_INFO_REFETCH;?>
					<!--<input type="checkbox" name="toggle" value="" checked="checked" onclick="checkAll(<?php echo count( $rows ); ?>);" />-->
				</th>
				<th align = "center" class="title" width="30">#</th>		
				<th align = "center"  class="title" width="15%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_MEDIA_TYPE;?></th>
				<th align = "center" class="title" width="30%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_TITLE;?></th>
				<th align = "center"  class="title" width="30%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_RESULT;?></th>
			</tr>
<?php

$i = 0;
while ($i < count($result)) {
	$row = & $result[$i];
?>
			<tr class="row<?php echo $i % 2; ?>">
				<td align = "center">
				<?php
				if ($row[3] != "OK") {
					echo "<input type='checkbox' id='cb'".$i."' name='bid[]' value='".$row[0]."' onclick='isChecked(this.checked);' />";
				} else {
					echo "&nbsp";
				}
?>
				</td>
				<td align = "center">
					<?php echo $row[0] ?>
				</td>
				<td align = "center">
					<?php echo $row[1] ?>
				</td>
				<td align = "center">
					<?php echo $row[2] ?>
				</td>
				<td align = "center">
					<?php echo $row[3] ?>
				</td>				
			</tr>

<?php		$i ++; } ?>

		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
	</table>
	</form>

<?php

	}


	function refetchMedias($option, & $rows, & $wslist) {
		global $my, $mosConfig_live_site,$mainframe;
		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');

		$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/medialibrary.css" type="text/css" />');

?>

	<form action="index2.php" method="post" name="adminForm">

	<table cellpadding="4" cellspacing="0" border="0" width="100%">

		<tr>
        <td  width="30%">
                <img src="./components/com_medialibrary/images/cfg.png" align="right" alt="Config" />
        </td>
        <td  width="70%" class="media_manager_caption" valign='bottom' >
                <?php echo _MEDIALIBRARY_REFETCH;?>
        </td>
		</tr>		
		<tr>
			<td align="left">&nbsp;
			</td>
		</tr>
		</table>
	<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
			<tr>
  			<td  colspan="6">
    			<strong><?php echo _MEDIALIBRARY_LABEL_INFO_FETCH;?></strong>

			<?php echo $wslist; ?>
  			&nbsp;&nbsp;&nbsp;<img src="../components/com_medialibrary/images/amazon/com-logo.gif" alt="amazon.com" border="0" />

			  </td>
			</tr>
			<tr>

        <th  class="title" width="20">
          <input type="checkbox" name="toggle" value="" checked="checked" 
              onClick="checkAll(<?php echo count( $rows ); ?>);" />
        </th>
        <th align = "center" class="title" width="30">#</th>		
        <th  align = "center" class="title" width="15%" nowrap="nowrap"><?php echo _HEADER_CATEGORY;?></th>
        <th align = "center" class="title" width="30%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_MEDIA_TYPE; ?></th>
        <th align = "center" class="title" width="30%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_TITLE;?></th>
        <th align = "center" class="title" width="25%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_FETCHED_FROM;?></th>

			</tr>

<?php
$i = 0;
while ($i < count($rows)) {
	$row = & $rows[$i];
?>
			<tr class="row<?php echo $i % 2; ?>">
				<td align = "center">
					<input type="checkbox" checked="checked" id="cb<?php echo $i;?>" name="bid[]" value="<?php echo $row->id; ?>" onClick="isChecked(this.checked);" />
				</td>
				<td align = "center">
					<?php echo $row->id ?>
				</td>
				<td align = "center">
					<?php echo $row->category ?>
				</td>
				<td align = "center">
					<?php echo $row->media_type ?>
				</td>
				<td align = "left">
					<?php echo $row->title ?>
				</td>
				<td align = "center">
					<?php
					echo mosMedialibraryWS :: getWsNameById($row->informationFrom);
?>                                                                                                                 				</td>
			</tr>
<?php		$i ++; } ?>
		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="1" />
	</table>
	</form>
<?php
	}


	function showImportExport($params, $option) {
		global $my, $mosConfig_live_site,$mainframe;
		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');

		$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/medialibrary.css" type="text/css" />');
?>
	
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>

<script type="text/javascript" language="Javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/overlib_mini.js">
</script>
	
<script language="javascript" type="text/javascript">
function impch()
{
	var a = document.getElementById('import_type').value;
	if(a == 3)
	document.getElementById('import_catid').disabled=true;
	else
	document.getElementById('import_catid').disabled=false;
	//	alert(a);
}
function expch()
{
	var a = document.getElementById('export_type').value;
	if(a == 3)
	document.getElementById('export_catid').disabled=true;
	else
	document.getElementById('export_catid').disabled=false;
	//	alert(a);
}
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if (pressbutton == 'import') {
		if (form.import_type.value == '0') {
			alert("<?PHP echo _MEDIALIBRARY_SHOW_IMPEXP_ERR1; ?>" );
			return;
		}
		if (form.import_file.value == '' && form.import_type.value == '3') {
			alert("<?PHP echo _MEDIALIBRARY_SHOW_IMPEXP_ERR3; ?>");
			return;
		}
		if (form.import_catid.value == '0' && form.import_type.value != '3' && form.import_type.value != '0') {
			alert("<?PHP echo _MEDIALIBRARY_SHOW_IMPEXP_ERR2; ?>");
			return;
		}
		if (form.import_catid.value != '0' && form.import_file.value == '') {
			alert("<?PHP echo _MEDIALIBRARY_SHOW_IMPEXP_ERR3; ?>");
			return;
		}
		if ((form.import_type.value == '2') && (form.import_catid.value != '0' && form.import_file.value != '')) {
			alert("<?php echo _MEDIALIBRARY_SHOW_IMPEXP_ERR5;?>");
			submitform( pressbutton );
		}
		if ((form.import_type.value == '1') && (form.import_catid.value != '0' && form.import_file.value != '')) {
			submitform( pressbutton );
		}
		if (form.import_file.value != '' && form.import_type.value == '3') {
			resultat_1 = confirm("<?php echo _MEDIALIBRARY_SHOW_IMPEXP_CONF;?>");
			if (resultat_1) submitform( pressbutton );
		}
	}
	if (pressbutton == 'export') {
		if (form.export_type.value == '0') {
			alert("<?PHP echo _MEDIALIBRARY_SHOW_IMPEXP_ERR4; ?>");
			return;
		}
		if (form.export_type.value == '3') {
			submitform( pressbutton );
		}
		if (form.export_type.value == '1') {
			submitform( pressbutton );
		}
		if (form.export_type.value == '2') {
			//alert("<?php echo _MEDIALIBRARY_SHOW_IMPEXP_ERR5;?>");
			submitform( pressbutton );
		}
	}
}//end function submitbutton(pressbutton)
</script>

      <table cellpadding="4" cellspacing="0" border="0" width="100%">
        <tr>
            <td width="30%">
              <img src="./components/com_medialibrary/images/cfg.png" align="right" alt="Config" />
            </td>
            <td width="70%" class="media_manager_caption" valign='bottom' >
                <?php echo _MEDIALIBRARY_ADMIN_IMPEXP; ?>
            </td>
        </tr>
      </table>

	<form action="index2.php" method="post" name="adminForm" enctype="multipart/form-data">
<?php
$tabs = new mosTabs(1);
$tabs->startPane("impexPane");
$tabs->startTab(_MEDIALIBRARY_ADMIN_IMP, "impexPane");
?>
      <table class="adminform">
<!--**********   begin add Warning in 'Import' for 'CSV', 'XML', 'MySQL tables import'   *********-->
	<tr>
		<td colspan="3">
		<?php echo _MEDIALIBRARY_SHOW_IMPORT_WARNING_MESSAG;?>
		<hr />
		</td>		
	</tr>
<!--************   end add Warning in 'Import' for 'CSV', 'XML', 'MySQL tables import'   *******-->
      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_SHOW_IMPEXP_LABEL_IMPORT_TYP; ?>:</td> <!-- Typ importu -->
         <td width="20"><?php echo mosToolTip(_MEDIALIBRARY_ADMIN_SHOW_IMPEXP_LABEL_IMPORT_TYP_TT_HEAD, _MEDIALIBRARY_ADMIN_SHOW_IMPEXP_LABEL_IMPORT_TYP ); ?></td>
         <td><?php echo $params['import']['type']; ?></td>
      </tr>
      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_SHOW_IMPEXP_LABEL_IMPORT_CATEGORY; ?>:</td> <!-- Kategoria -->
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_SHOW_IMPEXP_LABEL_IMPORT_CAT_TT_HEAD, _MEDIALIBRARY_ADMIN_SHOW_IMPEXP_LABEL_IMPORT_CAT ); ?></td>
         <td><?php echo $params['import']['category']; ?></td>         
      </tr>      
      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_SHOW_IMPEXP_LABEL_IMPORT_FILE; ?>:</td>   <!-- Plik do importu -->      
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_SHOW_IMPEXP_LABEL_IMPORT_FILE_TT_HEAD, _MEDIALIBRARY_ADMIN_SHOW_IMPEXP_LABEL_IMPORT_FILE ); ?></td>
         <td><input class="inputbox" type="file" name="import_file" value="" size="50" maxlength="250" /></td>         
      </tr>
      <tr>
	<td colspan="3">&nbsp;</td>
      </tr>
<!-- begin old poka ostavim
      <tr>
         <td width="185">&nbsp;</td>
         <td width="20">&nbsp;</td>
         <td>
		<?php //echo _MEDIALIBRARY_SHOW_IMPEXP_FORMAT;
		?>
	 </td>
      </tr>
end old poka ostavim -->
      </table>


<?php
$tabs->endTab();
$tabs->startTab(_MEDIALIBRARY_ADMIN_EXP, "impexPane");
?>
      <table class="adminform">
<!--*****************************************************************************************************************-->
<!--********************   begin add Warning in 'Export' for 'CSV', 'XML', 'MySQL tables import'   ******************-->
<!--*****************************************************************************************************************-->
	<tr>
		<td colspan="3">
		<?php echo _MEDIALIBRARY_SHOW_EXPORT_WARNING_MESSAG;?>
		<hr />
		</td>		
	</tr>
<!--*****************************************************************************************************************-->
<!--********************   end add Warning in 'Export' for 'CSV', 'XML', 'MySQL tables import'   ********************-->
<!--*****************************************************************************************************************-->
      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_SHOW_IMPEXP_LABEL_EXPORT_TYP; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_SHOW_IMPEXP_LABEL_EXPORT_TYP_TT_HEAD, _MEDIALIBRARY_ADMIN_SHOW_IMPEXP_LABEL_EXPORT_TYP ); ?></td>
         <td><?php echo $params['export']['type']; ?></td>
      </tr>
      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_SHOW_IMPEXP_LABEL_EXPORT_CATEGORY; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_SHOW_IMPEXP_LABEL_EXPORT_CAT_TT_HEAD, _MEDIALIBRARY_ADMIN_SHOW_IMPEXP_LABEL_EXPORT_CAT ); ?></td>
         <td><?php echo $params['export']['category']; ?></td>         
      </tr>
      <tr>
	<td colspan="3">&nbsp;</td>
      </tr>
      </table>
<?php
$tabs->endTab();
$tabs->endPane();
?>
		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="" />
	</form>
<?php
	}


	function showLendMedias($option, & $rows, & $userlist, $type)
	{
		global $my, $mosConfig_live_site,$mainframe;

		$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/medialibrary.css" type="text/css" />');

		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');

		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/includes/js/mambojavascript.js"></script>');


		$mainframe->addCustomHeadTag('<link rel="stylesheet" type="text/css" media="all" href="'.$mosConfig_live_site.'/includes/js/calendar/calendar-mos.css" title="green" />');

		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/includes/js/calendar/calendar.js"></script>');

		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/includes/js/calendar/lang/calendar-en-GB.js"></script>');

		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/includes/js/overlib_mini.js"></script>');

		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/includes/js/dhtml.js">
</script>');
?>

	<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>

	<form action="index2.php" method="post" name="adminForm" id="adminForm">

	<table cellpadding="4" cellspacing="0" border="0" width="100%">
    <tr>
     <td width="100%" class="media_manager_caption"  >
      <?php
      if ($type == "lend") {
        echo _MEDIALIBRARY_SHOW_LEND_MEDIAS;
      } else
      if ($type == "lend_return") {
        echo _MEDIALIBRARY_SHOW_LEND_RETURN;
      } else {
        echo "&nbsp;";
      }
      ?>
	   </td>
		</tr>		
		<tr>
		   <td align="left">&nbsp;
                     
		   </td>
		</tr>
	</table>
<?php
if ($type == "lend") {
?>
			<table cellpadding="4" cellspacing="0" border="0" width="100%">
				<tr>
		     <td align="center" nowrap="nowrap">
					 <?php echo _MEDIALIBRARY_LABEL_LEND_TO .':'; ?>
 				 </td>
				 <td align="center" nowrap="nowrap">
					 <?php echo $userlist; ?>
				 </td>
		     <td align="center" nowrap="nowrap">
					  <?php echo _MEDIALIBRARY_LABEL_LEND_USER .':'; ?>
          </td>
          <td>  
              <input type="text" name="user_name" class="inputbox" />
          </td>
          <td width="1000%">
          </td>
				 </tr>
				 <tr>
          <td align="left">&nbsp;
          </td>
          <td align="left">&nbsp;
          </td>
          <td align="left" nowrap="nowrap">
              <?php echo _MEDIALIBRARY_LABEL_LEND_EMAIL .':'; ?>
          </td>
          <td>    
              <input type="text" name="user_email" class="inputbox" />
          </td>
          <td width="30%">&nbsp;
          </td>
        </tr>
        <tr>
        <td align="left" nowrap="nowrap">
          <?php echo _MEDIALIBRARY_LABEL_LEND_TIME .':'; ?>
        </td>
			  <td align="left" nowrap="nowrap">
          <input class="inputbox" type="text" name="lend_until" id="lend_until" size="12" 
              maxlength="10" value="<?php echo date("Y-m-d"); ?>" />
          <input type="reset" class="button" value="..." 
            onClick="return showCalendar('lend_until', 'y-mm-dd');" />
				</td>
				<td colspan="3">&nbsp;
        </td>		
			</tr>
      <tr>
        <td align="left">&nbsp;
        </td>
			</tr>
		</table>
<?php
} else {
?>
		&nbsp;
<?php
}
?>
		<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
		 <tr>
      <th width="20">
        <input type="checkbox" checked="checked" name="toggle" value="" 
          onClick="checkAll(<?php echo count( $rows ); ?>);" />
      </th>
      <th align = "center" width="30">#</th>
      <th align = "center" class="title" width="5%" nowrap="nowrap">
        <?php echo _MEDIALIBRARY_LABEL_MEDIA_TYPE_ID; ?></th>
      <th align = "center" class="title" width="7%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_MEDIA_TYPE; ?></th>
      <th align = "center" class="title" width="7%" nowrap="nowrap"><?php echo _HEADER_CATEGORY; ?></th>
      <th align = "center" class="title" width="25%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_TITLE; ?></th>
      <th align = "center" class="title" width="15%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_LEND_FROM; ?></th>
      <th align = "center" class="title" width="20%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_LEND_UNTIL; ?></th>
      <th align = "center" class="title" width="15%" nowrap="nowrap"><?php echo _MEDIALIBRARY_LABEL_LEND_TO; ?></th>
     </tr>
<?php
    for ($i = 0, $n = count($rows); $i < $n; $i ++) {
      $row = & $rows[$i];
?>
		<tr class="row<?php echo $i % 2; ?>">
			<td width="20">
<?php
      //error for this row lend was called even if the book is already lent out
      if ($row->lend_from != null && $type == "lend") {
?>
					&nbsp;
<?php
      //lend was called for a correct book
      } else if ($row->lend_from == null && $type == "lend") {
?>
					<input type="checkbox" checked="checked" id="cb<?php echo $i;?>" 
            name="bid[]" value="<?php echo $row->id; ?>" onClick="isChecked(this.checked);" />
<?php
      //lend return was called on a book which was not lend out
      } else if ($row->lend_from == null && $type == "lend_return") {
?>
					&nbsp;
<?php
      //lend return was called correctly
      } else if ($row->lend_from != null && $type == "lend_return") {
?>
			<input type="checkbox" checked="checked" id="cb<?php echo $i;?>" name="bid[]" 
        value="<?php echo $row->lendid; ?>" onClick="isChecked(this.checked);" />
<?php
      } else {
?>
				&nbsp;
<?php
      }
?>
			</td>
			<td align="center"><?php echo $row->id; ?></td>
      <td align="center"><?php echo $row->media_type_id; ?></td>
      <td align="center"><?php echo $row->media_type; ?></td>
			<td align="center"><?php echo $row->category; ?></td>
			<td align="left"><?php echo $row->title; ?></td>
			<td align="center"><?php echo $row->lend_from; ?></td>
			<td align="center"><?php echo $row->lend_until ?></td>	
			<td align="left">			
<?php
      //if ($row->fk_userid == null) {
      	echo $row->user_name;
      	echo "&nbsp;";
      	echo "<a href='mailto:".$row->user_email."'>";
      	echo $row->user_email;
        echo "</a>";
/*      } else {
      	echo $row->name;
      	echo "&nbsp;";
      	echo "<a href='mailto:".$row->user_email."'>";
      	echo $row->email;
      	echo "</a>";
      }*/
?>
			</td>
     </tr>
<?php	 } ?>
		</table>
  		<input type="hidden" name="option" value="<?php echo $option;?>" />
	  	<input type="hidden" name="task" value="" />
		  <input type="hidden" name="boxchecked" value="1" />
		  <input type="hidden" name="save" value="1" />
	</form>
<?php
	}

//--------------------------------------------------
	function showConfiguration_frontend($lists, $option)
	{

		global $my, $mosConfig_live_site,$mainframe,$act, $task;

		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');


		$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/medialibrary.css" type="text/css" />');

?>

      <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>

      <script type="text/javascript" language="Javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/overlib_mini.js"></script>

      <table cellpadding="4" cellspacing="0" border="0" width="100%">
      <tr>
            <td width="30%">
                      <img src="./components/com_medialibrary/images/cfg.png" align="right" alt ="Config" />
              </td>
              <td width="70%" class="media_manager_caption" valign='bottom' >
                      <?php echo _MEDIALIBRARY_ADMIN_CONFIG_FRONTEND ?>
              </td>
      </tr>
      </table>

      <form action="index2.php" method="post" name="adminForm" id="adminForm">

      <table class="adminform">


      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_REVIEWS_SHOW; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_REVIEWS_SHOW_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_REVIEWS_SHOW_TT_HEAD ); ?></td>
         <td><?php echo $lists['reviews']['show']; ?></td>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_REVIEWS_REGISTRATIONLEVEL; ?>:</td>         
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_REVIEWS_REGISTRATIONLEVEL_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_REVIEWS_REGISTRATIONLEVEL_TT_HEAD ); ?></td>
         <td><?php echo $lists['reviews']['registrationlevel']; ?></td>         
      </tr>

      <tr>
      	<td colspan="6">
      		<hr />
      	</td>
      </tr>

      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_LENDSTATUS_SHOW; ?>:</td>

         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_LENDSTATUS_SHOW_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_LENDSTATUS_SHOW_TT_HEAD ); ?></td>
         <td><?php echo $lists['lendstatus']['show']; ?></td>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_LENDREQUEST_REGISTRATIONLEVEL; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_LENDREQUEST_REGISTRATIONLEVEL_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_LENDREQUEST_REGISTRATIONLEVEL_TT_HEAD ); ?></td>
         <td><?php echo $lists['lendrequest']['registrationlevel']; ?></td>         
      </tr>      


      <tr>
      	<td colspan="6">
      		<hr />
      	</td>
      </tr>

      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_PRICE_SHOW; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_PRICE_SHOW_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_PRICE_SHOW_TT_HEAD ); ?></td>
         <td><?php echo $lists['price']['show']; ?></td>
         <td width="185"></td>
         <td width="20"></td>
         <td></td> 
      </tr>
      <tr>
      	<td colspan="6">
	  <hr />
	</td>
      </tr>

	<tr>
		<td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_EMEDIAS_SHOW; ?>:</td>
		<td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_EMEDIAS_SHOW_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_EMEDIAS_SHOW_TT_HEAD ); ?></td>
		<td><?php echo $lists['emedias']['show']; ?></td>
		<td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_EMEDIS_REGISTRATIONLEVEL; ?>:</td>
		<td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_EMEDIS_REGISTRATIONLEVEL_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_EMEDIS_REGISTRATIONLEVEL_TT_HEAD ); ?></td>
		<td><?php echo $lists['emedias']['registrationlevel']; ?></td>
      </tr>
      <tr>
		<td colspan="6">
			<hr />
		</td>
      </tr>

<!--
//***********************************************************************************************
//				begin add FotoSize
//***********************************************************************************************
-->

      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_FOTO_SIZE; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_FOTO_SIZE_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_FOTO_SIZE_TT_HEAD ); ?></td>
         <td><?php echo ($lists['foto']['high']) . " / " . ($lists['foto']['width']); ?></td>
      </tr>
      <tr>
        <td colspan="6">
          <hr />
        </td>
      </tr>

<!--
//***********************************************************************************************
//				end add FotoSize
//***********************************************************************************************
-->

<!--
//***********************************************************************************************
//				begin add PageItems
//***********************************************************************************************
-->
      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_PAGE_ITEMS; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_PAGE_ITEMS_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_PAGE_ITEMS_TT_HEAD ); ?></td>
         <td><?php echo $lists['page']['items']; ?></td>
      </tr>
      <tr>
        <td colspan="6">
          <hr />
        </td>
      </tr>
<!--*******	end add PageItems ************ -->
<!--********   begin add for show in category picture   **************-->
      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_PICTURE_IN_CATEGORY; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_PICTURE_IN_CATEGORY_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_PICTURE_IN_CATEGORY_TT_HEAD ); ?></td>
         <td><?php echo $lists['cat_pic']['show']; ?></td>
      </tr>
      <tr>
        <td colspan="6">
          <hr />
        </td>
      </tr>
<!--***************   end add for show in category picture  *************-->

<!--********   begin add for show subcategory   **************-->
      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_SUBCATEGORY_SHOW; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_SUBCATEGORY_SHOW_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_SUBCATEGORY_SHOW_TT_HEAD ); ?></td>
         <td><?php echo $lists['subcategory']['show']; ?></td>
      </tr>
<!--***************   end add for show subcategory *************-->

     </table>
    <input type="hidden" name="option" value="<?php echo $option; ?>" />
    <input type="hidden" name="task" value="config_save_frontend" />
   </form>

<?php

	}


	function showConfiguration_backend($lists, $option) {

		global $mosConfig_live_site, $act, $task,$mainframe;
		$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/medialibrary.css" type="text/css" />');
?>

      <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>

      <script type="text/javascript" language="Javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/overlib_mini.js"></script>


      <table cellpadding="4" cellspacing="0" border="0" width="100%">
        <tr>
          <td width="30%">
                  <img src="./components/com_medialibrary/images/cfg.png" align="right" alt="Config" />
          </td>
          <td width="70%" class="media_manager_caption" valign='bottom' >
                  <?php echo _MEDIALIBRARY_ADMIN_CONFIG_BACKEND ?>
          </td>
        </tr>
       </table>


      <form action="index2.php" method="post" name="adminForm" id="adminForm">
	<table class="adminform">


      <tr>
        	<td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_IMAGES_DOWNLOAD; ?>:</td>
			<td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_IMAGES_DOWNLOAD_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_IMAGES_DOWNLOAD_TT_HEAD ); ?></td>
			<td><?php echo $lists['fetchImages']['boolean']; ?></td>
      </tr>
       <tr>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_IMAGES_DOWNLOAD_LOCATION; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_IMAGES_DOWNLOAD_LOCATION_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_IMAGES_DOWNLOAD_LOCATION_TT_HEAD ); ?></td>
         <td><?php echo $lists['fetchImages']['location']; ?></td>
      </tr>
      <tr>
      	<td colspan="3">
      		<hr />
      	</td>
      </tr>
      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_EMEDIAS_DOWNLOAD; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_EMEDIAS_DOWNLOAD_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_EMEDIAS_DOWNLOAD_TT_HEAD ); ?></td>
         <td><?php echo $lists['emedias']['allow']; ?></td>
      </tr>

      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_EMEDIAS_DOWNLOAD_LOCATION; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_EMEDIAS_DOWNLOAD_LOCATION_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_EMEDIAS_DOWNLOAD_LOCATION_TT_HEAD ); ?></td>
         <td><?php echo $lists['emedias']['location']; ?></td>
      </tr>
      <tr>
      	<td colspan="3">
      		<hr />
      	</td>
      </tr>
      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_WS_AMAZON_TAG; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_WS_AMAZON_TAG_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_WS_AMAZON_TAG_TT_HEAD ); ?></td>
         <td><?php echo $lists['ws']['amazon']['tag']; ?></td>
      </tr>
      <tr>
      	<td colspan="3">
      		<hr />
      	</td>
      </tr>

      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_WS_AMAZON_DEVTAG; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_WS_AMAZON_DEVTAG_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_WS_AMAZON_DEVTAG_TT_HEAD ); ?></td>
         <td><?php echo $lists['ws']['amazon']['devtag']; ?></td>
      </tr>

      <tr>
      	<td colspan="3">
      		<hr />
      	</td>
      </tr>
      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_EDITMEDIA_CHECK_ISBN_ASIN; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_EDITMEDIA_CHECK_ISBN_ASIN_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_EDITMEDIA_CHECK_ISBN_ASIN_TT_HEAD ); ?></td>
         <td><?php echo $lists['editmedia']['check']['isbn_asin']; ?></td>
      </tr>
      <tr>
      	<td colspan="3">
      		<hr />
      	</td>
      </tr>
      <tr>
         <td width="185"><?php echo _MEDIALIBRARY_ADMIN_CONFIG_EDITMEDIA_DEFAULT_LANG; ?>:</td>
         <td width="20"><?php echo mosToolTip( _MEDIALIBRARY_ADMIN_CONFIG_EDITMEDIA_DEFAULT_LANG_TT_BODY, _MEDIALIBRARY_ADMIN_CONFIG_EDITMEDIA_DEFAULT_LANG_TT_HEAD ); ?></td>
         <td><?php echo $lists['editmedia']['default']['lang']; ?></td>
      </tr>     
     </table>
        <input type="hidden" name="option" value="<?php echo $option; ?>" />
        <input type="hidden" name="task" value="config_save_backend" />
     </form>

<?php
	}
	function about() {

		global $mosConfig_live_site,$mainframe;
		$tabs = new mosTabs(0);

		$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/medialibrary.css" type="text/css" />');
?>
      <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
      <script type="text/javascript" language="Javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/overlib_mini.js"></script>

      <table cellpadding="4" cellspacing="0" border="0" width="100%">
        <tr>
          <td width="30%">
            <img src="./components/com_medialibrary/images/cfg.png" align="right" alt="Config" />
          </td>
          <td width="70%" class="media_manager_caption" valign='bottom' >
            <?php echo _MEDIALIBRARY_ADMIN_ABOUT ?>
          </td>
        </tr>
      </table>

      <form action="index2.php" method="post" name="adminForm" id="adminForm">
<?php
      $tabs->startPane("aboutPane");
      $tabs->startTab(_MEDIALIBRARY_ADMIN_ABOUT_ABOUT, "display-page");
?>
      <table class="adminform">
	      <tr>
	        <td width="80%">
				<h3><?PHP echo _MEDIALIBRARY__HTML_ABOUT; ?></h3>
				<?PHP echo _MEDIALIBRARY__HTML_ABOUT_INTRO; ?>
			</td>
	         <td width="20%">
<img src="../components/com_medialibrary/images/medialibrary_logo.png" align="right" alt="Media" />
	         </td>	         
	      </tr>

      </table>

<?php
$tabs->endTab();
//******************************   tab--2 about   **************************************
$tabs->startTab(_MEDIALIBRARY_ADMIN_ABOUT_RELEASENOTE, "display-page");
include_once("./components/com_medialibrary/doc/releasenote.php");
$tabs->endTab();
//******************************   tab--3 about--changelog.txt   ***********************
$tabs->startTab(_MEDIALIBRARY_ADMIN_ABOUT_CHANGELOG, "display-page");
include_once("./components/com_medialibrary/doc/changelog.html");
$tabs->endTab();

$tabs->endPane();
?>
	<!--        <input type="hidden" name="option" value="<?php /*echo $option; */?>">  -->
      </form>
<?php
	}
	function showImportResult($table, $option){
		global $my, $mosConfig_live_site,$mainframe;
		$mainframe->addCustomHeadTag('<script type = "text/JavaScript" src ="'.$mosConfig_live_site.'/administrator/components/com_medialibrary/includes/functions.js"></script>');

	?>
		<form action="index2.php" method="post" name="adminForm" id="adminForm">
			<table cellpadding='4' cellspacing='0' border='1' width='100%'>
				<tr>
	    			<td>#</td>
	    			<td><?php echo _MEDIALIBRARY_LABEL_ISBN_ASIN;?></td>
            <td><?php echo _MEDIALIBRARY_LABEL_MEDIA_TYPE;?></td>
            <td><?php echo _MEDIALIBRARY_SHOW_IMPEXP_LABEL_IMPORT_CATEGORY;?></td>
	    			<td><?php echo _MEDIALIBRARY_LABEL_TITLE;?></td>
	    			<td><?php echo _MEDIALIBRARY_LABEL_STATUS;?></td>
	    		</tr>

			<?php foreach ($table as $entry){
			?>
				<tr>
	    			<td><?php echo $entry[0]; ?></td>
	    			<td><?php echo $entry[1]; ?></td>
	    			<td><?php echo $entry[2]; ?></td>
	    			<td><?php echo $entry[3]; ?></td>
	    			<td><?php echo $entry[4]; ?></td>
	    			<td><?php echo $entry[5]; ?></td>
	    		</tr>
			<?php

			}
			?>
				</table>
				<input type="hidden" name="option" value="<?php echo $option;?>" />
				<input type="hidden" name="task" value="cancel" />
			</form>	

<?php	
	}


	function showExportResult($InformationArray, $option){
	?>	
	<form action="index2.php" method="post" name="adminForm" id="adminForm">

	  <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
      <script type="text/javascript" language="Javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/overlib_mini.js"></script>

     <table border="0" class="adminheading" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="middle">
        <th class="config"><?php echo _MEDIALIBRARY_SHOW_IMPEXP_RESULT;?></th>
        <td align="right"></td>
      </tr>
      </table>

		<?php echo _MEDIALIBRARY_SHOW_IMPEXP_RESULT_DOWNLOAD;?>  <br />
		<a href="<?php echo $InformationArray['urlBase'] . $InformationArray['out_file']; ?>" target="blank"><?php echo $InformationArray['urlBase'] . $InformationArray['out_file']; ?></a>
  		<br />
  		<?php echo _MEDIALIBRARY_SHOW_IMPEXP_RESULT_REMEMBER;?>  <br />  
			<input type="hidden" name="option" value="<?php echo $option;?>" />
			<input type="hidden" name="task" value="cancel" />
		</form>	

<?php

	}
}

?>
